-
direct_copy direct copy using language standard library
-
shell_copy direct copy using shell copy command
-
sha1_diff calculate sha1 hashes of both files using language standard library
-
shell_sha1_diff calculate sha1 hashes of both files using
/usr/bin/sha1sum
-
shell_diff using diff programs like GNU diff or git-diff to determine difference
-
read_and_compare_whole read files as a whole and compare in-memory
-
read_and_compare_chunk read chunks of files and compare in-memory until differ or end
-
direct_copy
-
Python
shutil.copyfile()
-
Node fs.writeFileSync(fs.readFileSync) on 7.10, fs.copyFileSync on >= 8.5
-
-
shell_copy
-
Python
subprocess.call()
;xcopy
on Windows,cp
on Linux -
Node
child_process.execSync('copy ..')
-
-
sha1_diff
-
Python
hashlib.sha1()
-
Node
crypto.createHash('sha1')
-
-
shell_sha1_diff
-
Python
subprocess.run(['sha1sum', ..], capture_output=True).stdout
-
Node
child_process.execSync('sha1sum ..')
-
-
shell_diff
-
Python
subprocess.run(['git-diff', '--no-index', '--name-status'], capture_output=True).stdout
-
Node
child_process.execSync('git-diff --no-index --name-status')
-
-
read_and_compare_chunk files read in 1024 byte chunks
-
if files are likely to differ, read in chunks and compare
-
if not,
-
for small files (~100k to ~1m), direct copy - don’t compare at all
-
for big files (~10m to ~100m),
diff
'em in the shell then copy if differ
-
-
Intel Core i7-8550U 4x 1.8GHz
-
16GB RAM
-
Debian 10.0 64-bit
-
Python 3.7.4
-
Node 10.15.2
average |
min |
max |
total |
|
Python direct_copy |
0.17 |
0.14 |
0.87 |
17.31 |
Python shell_copy |
2.74 |
2.28 |
3.25 |
273.63 |
Python sha1_diff |
0.31 |
0.24 |
0.48 |
30.71 |
Python shell_sha1_diff |
4.71 |
4.13 |
7.28 |
470.61 |
Python shell_diff |
2.55 |
2.23 |
3.11 |
254.98 |
Python read_and_compare_whole |
0.06 |
0.06 |
0.12 |
6.25 |
Python read_and_compare_chunk |
0.01 |
0.01 |
0.03 |
1.45 |
Node direct_copy |
0.15 |
0 |
1 |
15 |
Node shell_copy |
4.49 |
3 |
8 |
449 |
Node sha1_diff |
0.58 |
0 |
2 |
58 |
Node shell_sha1_diff |
4.41 |
3 |
10 |
441 |
Node shell_diff |
10.84 |
6 |
16 |
1084 |
Node read_and_compare_whole |
0.12 |
0 |
1 |
12 |
Node read_and_compare_chunk |
0.03 |
0 |
1 |
3 |
average |
min |
max |
total |
|
Python direct_copy |
1.40 |
0.81 |
4.17 |
139.63 |
Python shell_copy |
3.34 |
2.77 |
4.48 |
333.57 |
Python sha1_diff |
2.39 |
2.17 |
3.68 |
239.11 |
Python shell_sha1_diff |
8.35 |
7.65 |
11.78 |
834.59 |
Python shell_diff |
2.65 |
2.46 |
3.42 |
264.43 |
Python read_and_compare_whole |
0.76 |
0.54 |
2.58 |
76.41 |
Python read_and_compare_chunk |
0.02 |
0.02 |
0.03 |
1.78 |
Node direct_copy |
1.84 |
1 |
4 |
184 |
Node shell_copy |
6.48 |
4 |
18 |
648 |
Node sha1_diff |
3.02 |
2 |
6 |
302 |
Node shell_sha1_diff |
12.17 |
10 |
19 |
1217 |
Node shell_diff |
4.4 |
3 |
8 |
440 |
Node read_and_compare_whole |
2.06 |
1 |
4 |
206 |
Node read_and_compare_chunk |
0.02 |
0 |
1 |
2 |
average |
min |
max |
total |
|
Python direct_copy |
12.65 |
7.00 |
21.08 |
1264.54 |
Python shell_copy |
11.26 |
10.12 |
28.93 |
1126.17 |
Python sha1_diff |
24.55 |
23.63 |
31.09 |
2454.66 |
Python shell_sha1_diff |
42.78 |
42.20 |
45.49 |
4277.63 |
Python shell_diff |
2.57 |
2.21 |
3.26 |
257.058 |
Python read_and_compare_whole |
5.90 |
5.58 |
10.01 |
590.50 |
Python read_and_compare_chunk |
0.02 |
0.02 |
0.06 |
2.00 |
Node direct_copy |
11.63 |
9 |
22 |
1163 |
Node shell_copy |
13.79 |
12 |
30 |
1379 |
Node sha1_diff |
25.92 |
24 |
41 |
2592 |
Node shell_sha1_diff |
47.28 |
45 |
68 |
4728 |
Node shell_diff |
4.92 |
4 |
9 |
492 |
Node read_and_compare_whole |
11.01 |
9 |
20 |
1101 |
Node read_and_compare_chunk |
0.03 |
0 |
1 |
3 |
average |
min |
max |
total |
|
Python direct_copy |
143.91 |
70.96 |
196.10 |
14390.73 |
Python shell_copy |
131.35 |
91.16 |
301.93 |
13134.70 |
Python sha1_diff |
248.78 |
242.84 |
267.23 |
24877.72 |
Python shell_sha1_diff |
391.50 |
387.80 |
404.79 |
39149.54 |
Python shell_diff |
2.49 |
2.17 |
3.16 |
249.32 |
Python read_and_compare_whole |
54.07 |
52.60 |
66.63 |
5407.09 |
Python read_and_compare_chunk |
0.02 |
0.02 |
0.07 |
2.32 |
Node direct_copy |
117.78 |
80 |
177 |
11778 |
Node shell_copy |
131 |
89 |
190 |
13100 |
Node sha1_diff |
250.32 |
245 |
278 |
25032 |
Node shell_sha1_diff |
410.98 |
405 |
444 |
41098 |
Node shell_diff |
7.22 |
6 |
10 |
722 |
Node read_and_compare_whole |
96.44 |
93 |
125 |
9644 |
Node read_and_compare_chunk |
0.03 |
0 |
1 |
3 |