node
node copied to clipboard
fs: improve `cpSync` performance
By moving the function to C++, we should get a significant improvement in performance.
I'm extremely open to suggestions on improving the benchmarks, but with the current state, here are the results:
local benchmarks
macOS M1 Max
confidence improvement accuracy (*) (**) (***)
fs/bench-cpSync.js n=1 *** 63.75 % ±10.38% ±13.83% ±18.03%
fs/bench-cpSync.js n=100 *** 607.18 % ±46.07% ±62.03% ±82.22%
fs/bench-cpSync.js n=10000 *** 690.84 % ±30.74% ±41.37% ±54.83%
Be aware that when doing many comparisons the risk of a false-positive result increases.
In this case, there are 3 comparisons, you can thus expect the following amount of false-positive results:
0.15 false positives, when considering a 5% risk acceptance (*, **, ***),
0.03 false positives, when considering a 1% risk acceptance (**, ***),
0.00 false positives, when considering a 0.1% risk acceptance (***)
benchmark ci
19:04:42 confidence improvement accuracy (*) (**) (***)
19:04:42 fs/bench-cpSync.js n=1 *** 154.37 % ±6.67% ±8.88% ±11.57%
19:04:42 fs/bench-cpSync.js n=100 *** 163.66 % ±9.09% ±12.22% ±16.16%
19:04:42 fs/bench-cpSync.js n=10000 *** 103.21 % ±0.96% ±1.28% ±1.67%
benchmark ci: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1572/