digitalbazaar / rdf-canonize

An implementation of the RDF Dataset Normalization Algorithm in JavaScript.
Other
22 stars 13 forks source link

Optimize WebCrypto bytes-to-hex. #63

Closed davidlehn closed 1 year ago

davidlehn commented 1 year ago

Getting consistent benchmarks on a non-idle system for the async webcrypto code is difficult. Numbers below can be +/-2%.

bytes-to-hex

Comparison

Test 'base' 'precompute' 'buffer'
#manifest#block-1 4709.85 5.53% 5.36%
#manifest#block-2 863.09 8.77% 11.26%
#manifest#block-10 189.20 6.40% 7.34%
#manifest#block-100 18.97 9.89% 12.30%
#manifest#block-1000 1.97 4.21% 5.90%

base ops/s and relative difference (higher is better)

Environment

Key Values
Label 'base', 'precompute', 'buffer'
Arch x64
CPU Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
CPUs 8
Platform linux
Runtime Node.js
Runtime Version v16.19.1
Comment 'bytes-to-hex'