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
No JavaScript Benchmarks? #37
Comments
JavaScript was added to give browsers access to backed data so that no conversion would be needed. NodeJS changes all that and I know little about it's performance characteristics. Don't expect peak results yet it should be easy to make it fast. So how does one make JavaScript benchmarks work? Would you care to help? |
I just tried running it, I could provide the code but I can't marshal + unmarshal and get the same result. It's also more than 2x slower than JSON in my benchmark. |
Please share @lewisdiamond. I'll be happy to make it fast. No problem. You can make a pull request or mail to pascal@quies.net. |
I have a few days off so the sooner the better @lewisdiamond. No need for a nice delivery. I just need a little help with the benchmark setup. |
@pascaldekloe Well the problem I have right now is that the JS code generated by
|
Also, consider making the generated Javascript code actually just load a C version compiled to WASM. |
Yes WASM sounds really cool yet that's another issue/feature. I'm not sure where the Also, I just fixed issue #40 with an int64 bug. If you use that datatype please try version 1.7.2 and/or Maven plugin 1.11.2. |
Sorry I omitted it. |
Ah, then yes, your setup seems right. I downloaded
For some reason |
Did you download benchmark.js from there? https://raw.githubusercontent.com/bestiejs/benchmark.js/master/benchmark.js
|
That exact file yes. Now I know this is supposed to work. Thanks for helping out.
|
It's likely because you don't have the lodash dependency.
That does not fulfill the dependency requirement.
Try this:
Alternatively, use npm or yarn:
then you can just do this:
|
That root import did the trick and the suggested framework plays nicely. I can start tuning now. |
The current (untuned) code compared to the native JSON.
|
Check out protobuf.js https://github.com/dcodeIO/ProtoBuf.js/ Note that it may still be worth to have a browser compatible version (at least for older browser since new ones support WASM) |
The ProtoBuf.js link was quite useful as a reference @lewisdiamond. I did not expect JavaScript to be 50 to 100 times slower than most languages. 😧 This basically means that if you care about performance at all then JavaScript is a no-go and we need WASM to save the day. Colfer is a bit faster than Node's native [C++] JSON now but not by much.
For some reason the standard DataView/Uint8Array performs horrible. ProtoBuf.js made it's own libraries for integer and floating point encoding to compensate. Doubling the speed with more tuning effort is quite possible yet because those numbers still look bad I'll leave things as they are for now and defer to V8 for TypedArray optimisation. |
Would love to see how the built-in JSON and Protobuf fare against colfer. Its kinda unfair to see C, Go, and Java make it to the benchmark games and JS stays at home. Could it be that the JS version couldn't live up to the Colfer performance promise?
The text was updated successfully, but these errors were encountered: