File: speed_compare.py

package info (click to toggle)
python-sabyenc 5.4.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 39,044 kB
  • sloc: cpp: 12,297; sh: 1,121; python: 652; ansic: 191; makefile: 13
file content (25 lines) | stat: -rw-r--r-- 703 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import sabyenc3
import time


###################
# Real test
###################

nr_runs = 1000
chunk_size = 14

# Read some data (can pick any of the files from the yencfiles folder)
with open("tests/yencfiles/test_regular.txt", "rb") as yencfile:
    data_raw = yencfile.read()
    data_bytes = len(data_raw)
    n = 2**chunk_size
    data_chunks = [data_raw[i : i + n] for i in range(0, len(data_raw), n)]

# Time it!
time1_new = time.process_time()
for i in range(nr_runs):
    decoded_data_new, output_filename, crc_correct = sabyenc3.decode_usenet_chunks(data_chunks)
time1_new_disp = 1000 * (time.process_time() - time1_new)
print("%15s  took  %4d ms" % ("yEnc C New", time1_new_disp))
print()