Investigate third-party `Buffer` implementation

RESOLVED INCOMPLETE

Status

Add-on SDK
General
P3
normal
RESOLVED INCOMPLETE
5 years ago
9 months ago

People

(Reporter: jsantell, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

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

Updated

5 years ago
Priority: -- → P3
Adding blocker of bug 952403 as the implementation above prevents us extending Uint8Arrays
Depends on: 952403

Comment 2

5 years ago
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.

Comment 3

5 years ago
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.
(Reporter)

Updated

5 years ago
Depends on: 695438
No longer depends on: 952403

Comment 5

4 years ago
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 :)
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
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.