sledgehammer icon indicating copy to clipboard operation
sledgehammer copied to clipboard

Benchmark custom string caching

Open ealmloff opened this issue 3 years ago • 2 comments

Currently there is no way to cache strings for values, etc. Caching strings requires hashing every string that passes between wasm <-> js. How does the cost of hashing compare to the cost of copying and decoding the string?

ealmloff avatar Nov 04 '22 16:11 ealmloff

This makes a difference for large strings, makes no difference for small strings, and adds some overhead for cache misses See: https://github.com/Demonthos/sledgehammer_test It uses a SIMD accelerated non-cyptographic hash

ealmloff avatar Nov 05 '22 20:11 ealmloff

I would like to implement this either for &'static str only so that we can just use the pointer as a hash or only implement this for attribute and element names as they would be commonly reused

ealmloff avatar Nov 05 '22 20:11 ealmloff