-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Encoder calls Readable.push #5
Comments
I was interested in how fast I could get cbor parsing, so I forked this library, and dropped all streaming moving to a pure sync interface to see how fast I could get things, current results on Node 7 are below
The repo is here if you are interested : https://github.com/dignifiedquire/fast-cbor |
if we're going to compare against JSON.parse, and go full-sync, then we should move the code into C. One starting point is https://github.com/cabo/cn-cbor, but others are listed here: http://cbor.io/impls.html |
@hildjj yeah I can't really do that because I have to run it in the browser, I was just curious how close JavaScript could come to something like the JSON methods |
What if you proved that it was faster than JSON if implemented in C, at least one browser vendor decided to give you a native implementation, and we made one of these versions a polyfill? (I work at Mozilla, but not on the platform team. I'll have to give them a patch and get them interested in taking it) |
Fun fact, the code even though the encoder is written in hand rolled asm.js is a decent factor slower in the latest Firefox compared to Chrome which I didn't expect. But I haven't done any detailed analysis as to where exactly that come from.
That would be pretty cool, I think the first thing to test would be adding a native version for node, as that is a bit easier to experiment with, than a browser patch (at least in my experience,... still trying to get servo to build :D) |
agree. Added #40 to track that explicitly. In the meantime, are you open to merging your fork back into this project for the synchronous path? |
Sure, I just changed so much that I wasn't sure if and how you would want to merge those changes in here. |
Your perf results are compelling. I still want to be able to use the streaming mode if possible, code size matters somewhat, and I don't want to have to fix bugs in two places. Other than that, I'm open to lots of approaches, including patches that are relatively invasive. |
This causes an unneeded copy. Perhaps make BufferStream Readable instead of Writable, and copy the push semantics in? Perhaps look at patching Readable upstream to allow unbuffered access one day.
The text was updated successfully, but these errors were encountered: