Closed cakoose closed 6 years ago
Bindings are working, but when you use bindings overhead added in converting data between node objects and C/C++ objects. So, sometimes bindings is significantly slow than pure JS implementation. Performance also depends from different factors, for example, this is my benchmark: node 10.4.0, linux with kernel 4.16.13-300.fc28.x86_64
Bindings (current) x 259,824 ops/sec ±5.67% (77 runs sampled)
Pure JS (current) x 146,439 ops/sec ±7.23% (74 runs sampled)
Bindings (sha3) x 254,129 ops/sec ±6.25% (71 runs sampled)
Pure JS (js-sha3) x 137,107 ops/sec ±56.66% (76 runs sampled)
Buffer 0bytes: fastest is Bindings (current),Bindings (sha3)
Bindings (current) x 7.72 ops/sec ±3.26% (23 runs sampled)
Pure JS (current) x 3.63 ops/sec ±3.71% (14 runs sampled)
Bindings (sha3) x 7.55 ops/sec ±4.52% (23 runs sampled)
Pure JS (js-sha3) x 4.28 ops/sec ±1.74% (15 runs sampled)
Buffer 10MiB: fastest is Bindings (current),Bindings (sha3)
I expected the native bindings would be faster than the pure JS implementation but when I run the benchmark, it shows the opposite. Perhaps I'm not building the native bindings correctly?
Benchmark results:
My system: Node v8.11.1, macOS 10.13.4.
Steps to reproduce: