Exemplo n.º 1
0
def bench():
    results = [decode(d) for d in file_data]
Exemplo n.º 2
0
from os import listdir
import cProfile
import pstats
from bencodepy.decoder import decode
from bencodepy.encode import encode


folder_path = '../torrent meta testing samples/'

file_data = []
for file_name in listdir(folder_path):
    with open(folder_path + file_name, 'rb') as f:
        data = f.read()
        file_data.append(data)

python_data = [decode(d) for d in file_data]

for i, obj in enumerate(python_data):
    print('Sample data {0}: {1} .'.format(i, obj))


python_data *= 6000
print('Number of objects to decode: {0}.'.format(len(python_data)))

results = []


def bench():
    global results
    results = [encode(r) for r in python_data]
Exemplo n.º 3
0
def bench():
    results = [decode(d) for d in file_data]
Exemplo n.º 4
0
from os import listdir
import cProfile
import pstats
from bencodepy.decoder import decode
from bencodepy.encode import encode

folder_path = '../torrent meta testing samples/'

file_data = []
for file_name in listdir(folder_path):
    with open(folder_path + file_name, 'rb') as f:
        data = f.read()
        file_data.append(data)

python_data = [decode(d) for d in file_data]

for i, obj in enumerate(python_data):
    print('Sample data {0}: {1} .'.format(i, obj))

python_data *= 6000
print('Number of objects to decode: {0}.'.format(len(python_data)))

results = []


def bench():
    global results
    results = [encode(r) for r in python_data]


def print_size():