This implementation can be used via browserify to implement node-style APIs in a browser. Uses Uint8Array as the back end, similar to our current implementation. Not sure if this is better, or not as good, as our current implementation, but may be worth investigating. Also, we discussed having third party dependencies in our SDK, and also allowing developers to pick and choose their own implementations. This would only work with good documentation referring to 'common/popular' replacements https://github.com/feross/native-buffer-browserify
Adding blocker of bug 952403 as the implementation above prevents us extending Uint8Arrays
Depends on: 952403
Hi, author of native-buffer-browserify here. FWIW, the non-Uint8Array implementation of Buffer is still really fast in Firefox. Sure, it's based on Object, but it's almost as fast as the version based on Uint8Array. Depending on your intended use-case, you could probably use the module as-is, even without the aforementioned bug being fixed. It'll get even faster once you have support for augmentable Uint8Arrays.
Also, just want to chime in that being able to use a familiar API like node's instead of something custom for Firefox would be a huge win for code re-use and onboarding new developers.
Feross, thanks for your work and input! I'll investigate more and see if this could work. Agreed that familiar API's like node's buffers is a huge win.
Just wanted to let you guys know that native-buffer-browserify (now simply called 'buffer' on npm) uses the fast typed array implementation in Firefox now! Thanks to the great work in bug #695438, it's now possible to add new properties to Firefox's typed arrays. I just tested 'buffer' in Firefox Nightly (30) and it's working well. And twice as fast as Chrome's implementation :)
Status: NEW → RESOLVED
Last Resolved: 9 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.