-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add browser support? #1
Comments
Thanks @josephrocca Firstly, the benchmark in Chromium 9348 is measuring much more than just Secondly, regarding getting
You should be able to test for performance regressions (if any) by swapping in That said, it would be good to support |
Thanks for the tip about the 9348 bug! Seems like you're right about it having to do with strings/GC - if I take away the |
Anytime! It would be interesting to remove the actual
Please do, that will be appreciated.
Are you testing multiple large ArrayBuffer instances? That might help to avoid crashes. For example, I think a V8 string used to take a minimum of 24 bytes, regardless of what's stored in it. |
It could also just be a policy difference. But it would definitely be good to figure out exactly what it is. |
If I remove
No, I've very naively just tried to create millions of Map objects (each with thousands to hundreds of thousands of keys) and hoped that V8 would sort everything out for me. I'm a mere web developer 😅 Starting to learn more about lower-level memory stuff and learning Rust, so I'll probably submit less-noobish bug reports to V8 crbug over time. |
Rust is cool, https://ziglang.org is also worth checking out. Zig's error handling sets are awesome. It strikes an almost perfect balance. It's closer to C than Rust, which is closer to C++. I'm also a mere web developer and I don't think my own noobish bug reports ever get better over time. 😅 Always worth submitting a crbug! |
Thanks! I will definitely check out Zig :) |
I've recently been having quite a bit of trouble with the browser's built-in Map:
So I went hunting and found your project - it looks great! Is there any interest in making it browser-compatible by detecting if the code is running in a browser and switching out Buffer for ArrayBuffer? Or even just using feross's browser-based buffer polyfill? https://github.com/feross/buffer
For
crypto.randomBytes
, there's this isomorphic lib: https://www.npmjs.com/package/randombytesEdit: Here's a working proof of concept: https://gist.github.com/josephrocca/019f091e5f83e410533caeb6f371200e
All I did was:
Then, in
index.js
, swaprequire('crypto').randomBytes
forrequire('randombytes')
, and then just:I haven't used browserify before so that linked script pulls HashTable and Buffer out of the module in a weird way... but it works! (see bottom of
HashTable.mjs
)The text was updated successfully, but these errors were encountered: