rndusr / torf

Python module to create, parse and edit torrent files and magnet links
GNU General Public License v3.0
180 stars 17 forks source link

refactor: simplify piece size logic #35

Closed cannibalChipper closed 12 months ago

cannibalChipper commented 1 year ago

Reference: https://github.com/rndusr/torf-cli/issues/33

Piece size remains mostly identical for filesizes below 16GiB with an immediate jump to 16MiB per piece for filesizes larger than 16GiB. This gives a bit of a speed increase when creating and/or rehecking torrents due to lesser number of pieces for 16GiB+ torrents

Filesize (GiB) Current behavior This PR
1.0 1024.0 pieces @ 1.0 MiB each 1024.0 pieces @ 1.0 MiB each
2.0 2048.0 pieces @ 1.0 MiB each 2048.0 pieces @ 1.0 MiB each
3.0 1536.0 pieces @ 2.0 MiB each 1536.0 pieces @ 2.0 MiB each
4.0 2048.0 pieces @ 2.0 MiB each 2048.0 pieces @ 2.0 MiB each
5.0 2560.0 pieces @ 2.0 MiB each 1280.0 pieces @ 4.0 MiB each
6.0 3072.0 pieces @ 2.0 MiB each 1536.0 pieces @ 4.0 MiB each
7.0 1792.0 pieces @ 4.0 MiB each 1792.0 pieces @ 4.0 MiB each
8.0 2048.0 pieces @ 4.0 MiB each 2048.0 pieces @ 4.0 MiB each
9.0 1152.0 pieces @ 8.0 MiB each 1152.0 pieces @ 8.0 MiB each
10.0 1280.0 pieces @ 8.0 MiB each 1280.0 pieces @ 8.0 MiB each
11.0 1408.0 pieces @ 8.0 MiB each 1408.0 pieces @ 8.0 MiB each
12.0 1536.0 pieces @ 8.0 MiB each 1536.0 pieces @ 8.0 MiB each
13.0 1664.0 pieces @ 8.0 MiB each 1664.0 pieces @ 8.0 MiB each
14.0 1792.0 pieces @ 8.0 MiB each 1792.0 pieces @ 8.0 MiB each
15.0 1920.0 pieces @ 8.0 MiB each 1920.0 pieces @ 8.0 MiB each
16.0 2048.0 pieces @ 8.0 MiB each 2048.0 pieces @ 8.0 MiB each
17.0 2176.0 pieces @ 8.0 MiB each 1088.0 pieces @ 16.0 MiB each
18.0 2304.0 pieces @ 8.0 MiB each 1152.0 pieces @ 16.0 MiB each
19.0 2432.0 pieces @ 8.0 MiB each 1216.0 pieces @ 16.0 MiB each
20.0 2560.0 pieces @ 8.0 MiB each 1280.0 pieces @ 16.0 MiB each
21.0 2688.0 pieces @ 8.0 MiB each 1344.0 pieces @ 16.0 MiB each
22.0 2816.0 pieces @ 8.0 MiB each 1408.0 pieces @ 16.0 MiB each
23.0 2944.0 pieces @ 8.0 MiB each 1472.0 pieces @ 16.0 MiB each
24.0 3072.0 pieces @ 8.0 MiB each 1536.0 pieces @ 16.0 MiB each
25.0 3200.0 pieces @ 8.0 MiB each 1600.0 pieces @ 16.0 MiB each
26.0 3328.0 pieces @ 8.0 MiB each 1664.0 pieces @ 16.0 MiB each
27.0 3456.0 pieces @ 8.0 MiB each 1728.0 pieces @ 16.0 MiB each
28.0 3584.0 pieces @ 8.0 MiB each 1792.0 pieces @ 16.0 MiB each
29.0 3712.0 pieces @ 8.0 MiB each 1856.0 pieces @ 16.0 MiB each
30.0 3840.0 pieces @ 8.0 MiB each 1920.0 pieces @ 16.0 MiB each
31.0 3968.0 pieces @ 8.0 MiB each 1984.0 pieces @ 16.0 MiB each
32.0 4096.0 pieces @ 8.0 MiB each 2048.0 pieces @ 16.0 MiB each
33.0 4224.0 pieces @ 8.0 MiB each 2112.0 pieces @ 16.0 MiB each
34.0 4352.0 pieces @ 8.0 MiB each 2176.0 pieces @ 16.0 MiB each
35.0 4480.0 pieces @ 8.0 MiB each 2240.0 pieces @ 16.0 MiB each
36.0 4608.0 pieces @ 8.0 MiB each 2304.0 pieces @ 16.0 MiB each
37.0 4736.0 pieces @ 8.0 MiB each 2368.0 pieces @ 16.0 MiB each
38.0 4864.0 pieces @ 8.0 MiB each 2432.0 pieces @ 16.0 MiB each
39.0 4992.0 pieces @ 8.0 MiB each 2496.0 pieces @ 16.0 MiB each
40.0 5120.0 pieces @ 8.0 MiB each 2560.0 pieces @ 16.0 MiB each
41.0 5248.0 pieces @ 8.0 MiB each 2624.0 pieces @ 16.0 MiB each
42.0 5376.0 pieces @ 8.0 MiB each 2688.0 pieces @ 16.0 MiB each
43.0 5504.0 pieces @ 8.0 MiB each 2752.0 pieces @ 16.0 MiB each
44.0 5632.0 pieces @ 8.0 MiB each 2816.0 pieces @ 16.0 MiB each
45.0 5760.0 pieces @ 8.0 MiB each 2880.0 pieces @ 16.0 MiB each
46.0 5888.0 pieces @ 8.0 MiB each 2944.0 pieces @ 16.0 MiB each
47.0 6016.0 pieces @ 8.0 MiB each 3008.0 pieces @ 16.0 MiB each
48.0 6144.0 pieces @ 8.0 MiB each 3072.0 pieces @ 16.0 MiB each
49.0 6272.0 pieces @ 8.0 MiB each 3136.0 pieces @ 16.0 MiB each
50.0 6400.0 pieces @ 8.0 MiB each 3200.0 pieces @ 16.0 MiB each
51.0 6528.0 pieces @ 8.0 MiB each 3264.0 pieces @ 16.0 MiB each
52.0 6656.0 pieces @ 8.0 MiB each 3328.0 pieces @ 16.0 MiB each
53.0 6784.0 pieces @ 8.0 MiB each 3392.0 pieces @ 16.0 MiB each
54.0 6912.0 pieces @ 8.0 MiB each 3456.0 pieces @ 16.0 MiB each
55.0 7040.0 pieces @ 8.0 MiB each 3520.0 pieces @ 16.0 MiB each
56.0 7168.0 pieces @ 8.0 MiB each 3584.0 pieces @ 16.0 MiB each
57.0 7296.0 pieces @ 8.0 MiB each 3648.0 pieces @ 16.0 MiB each
58.0 7424.0 pieces @ 8.0 MiB each 3712.0 pieces @ 16.0 MiB each
59.0 7552.0 pieces @ 8.0 MiB each 3776.0 pieces @ 16.0 MiB each
60.0 7680.0 pieces @ 8.0 MiB each 3840.0 pieces @ 16.0 MiB each
61.0 7808.0 pieces @ 8.0 MiB each 3904.0 pieces @ 16.0 MiB each
62.0 7936.0 pieces @ 8.0 MiB each 3968.0 pieces @ 16.0 MiB each
63.0 8064.0 pieces @ 8.0 MiB each 4032.0 pieces @ 16.0 MiB each
64.0 8192.0 pieces @ 8.0 MiB each 4096.0 pieces @ 16.0 MiB each
65.0 8320.0 pieces @ 8.0 MiB each 4160.0 pieces @ 16.0 MiB each
66.0 8448.0 pieces @ 8.0 MiB each 4224.0 pieces @ 16.0 MiB each
67.0 8576.0 pieces @ 8.0 MiB each 4288.0 pieces @ 16.0 MiB each
68.0 8704.0 pieces @ 8.0 MiB each 4352.0 pieces @ 16.0 MiB each
69.0 8832.0 pieces @ 8.0 MiB each 4416.0 pieces @ 16.0 MiB each
70.0 8960.0 pieces @ 8.0 MiB each 4480.0 pieces @ 16.0 MiB each
71.0 9088.0 pieces @ 8.0 MiB each 4544.0 pieces @ 16.0 MiB each
72.0 9216.0 pieces @ 8.0 MiB each 4608.0 pieces @ 16.0 MiB each
73.0 9344.0 pieces @ 8.0 MiB each 4672.0 pieces @ 16.0 MiB each
74.0 9472.0 pieces @ 8.0 MiB each 4736.0 pieces @ 16.0 MiB each
75.0 9600.0 pieces @ 8.0 MiB each 4800.0 pieces @ 16.0 MiB each
76.0 9728.0 pieces @ 8.0 MiB each 4864.0 pieces @ 16.0 MiB each
77.0 9856.0 pieces @ 8.0 MiB each 4928.0 pieces @ 16.0 MiB each
78.0 9984.0 pieces @ 8.0 MiB each 4992.0 pieces @ 16.0 MiB each
79.0 10112.0 pieces @ 8.0 MiB each 5056.0 pieces @ 16.0 MiB each
80.0 10240.0 pieces @ 8.0 MiB each 5120.0 pieces @ 16.0 MiB each
81.0 5184.0 pieces @ 16.0 MiB each 5184.0 pieces @ 16.0 MiB each
82.0 5248.0 pieces @ 16.0 MiB each 5248.0 pieces @ 16.0 MiB each
83.0 5312.0 pieces @ 16.0 MiB each 5312.0 pieces @ 16.0 MiB each
84.0 5376.0 pieces @ 16.0 MiB each 5376.0 pieces @ 16.0 MiB each
85.0 5440.0 pieces @ 16.0 MiB each 5440.0 pieces @ 16.0 MiB each
86.0 5504.0 pieces @ 16.0 MiB each 5504.0 pieces @ 16.0 MiB each
87.0 5568.0 pieces @ 16.0 MiB each 5568.0 pieces @ 16.0 MiB each
88.0 5632.0 pieces @ 16.0 MiB each 5632.0 pieces @ 16.0 MiB each
89.0 5696.0 pieces @ 16.0 MiB each 5696.0 pieces @ 16.0 MiB each
90.0 5760.0 pieces @ 16.0 MiB each 5760.0 pieces @ 16.0 MiB each
91.0 5824.0 pieces @ 16.0 MiB each 5824.0 pieces @ 16.0 MiB each
92.0 5888.0 pieces @ 16.0 MiB each 5888.0 pieces @ 16.0 MiB each
93.0 5952.0 pieces @ 16.0 MiB each 5952.0 pieces @ 16.0 MiB each
94.0 6016.0 pieces @ 16.0 MiB each 6016.0 pieces @ 16.0 MiB each
95.0 6080.0 pieces @ 16.0 MiB each 6080.0 pieces @ 16.0 MiB each
96.0 6144.0 pieces @ 16.0 MiB each 6144.0 pieces @ 16.0 MiB each
97.0 6208.0 pieces @ 16.0 MiB each 6208.0 pieces @ 16.0 MiB each
98.0 6272.0 pieces @ 16.0 MiB each 6272.0 pieces @ 16.0 MiB each
99.0 6336.0 pieces @ 16.0 MiB each 6336.0 pieces @ 16.0 MiB each
100.0 6400.0 pieces @ 16.0 MiB each 6400.0 pieces @ 16.0 MiB each