4 ms·
*for a very specific use-case where you have an ungodly amount of data to insert Still, it's interesting that there is something to be gained under these circu
by _bxg1 6y ago
*for a very specific use-case where you have an ungodly amount of data to insert
Still, it's interesting that there is something to be gained under these circumstances. I'm typically skeptical of this sort of thing because the standard library is written in C++. One time I thought I was very clever and hand-wrote a more appropriate sorting algorithm for a specific use-case only to discover that, no, Array.sort() was still faster by sheer brute force.
- austincheney 6y agoThe algorithm for Array.sort is implementation specific, but there is an ECMAScript proposal for a standard algorithm.
- jorangreef 6y agoWe actually wrote the original version in C with SIMD extensions as a Node.js binding, but the JavaScript version was still twice as fast. I kid you not. You will find the reason for this in the README, it's the last bullet point under "Fast": https://github.com/ronomon/hash-table#fast https://github.com/ronomon/hash-table#fast
- _bxg1 6y agoHuh. Does that apply to WASM too or just to binding from Node?
- jorangreef 6y agoI am not sure but I wouldn't think so, unless you have to serialize/deserialize or otherwise transform or inspect function call arguments in some or other way, as you need to do when binding JavaScript with C.