-
Notifications
You must be signed in to change notification settings - Fork 127
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
Encoded binary is different from other library #10
Comments
Short answer:
Longer answer:
Only the difference is http://kawanet.github.io/msgpack-lite/ DA 00 30 http://msgpack-json-editor.com/ D9 30 Both two of above represents https://github.com/msgpack/msgpack/blob/master/spec.md
I'll check our code later. Thank you anyway for the report. |
Try: It seems the binaries listed above are reversed. http://kawanet.github.io/msgpack-lite/ ->
http://msgpack-json-editor.com ->
Conclusion: msgpack-lite gives better binary. msgpack-json-editor gives one-byte-longer binary. |
Thank you for quick answer and detailed description! I understand http://msgpack-json-editor.com (which would use the library https://github.com/msgpack/msgpack-javascript) looks a bug in decoding. |
Well, there's another difference,
|
@royaltm It's interesting that ECMAScript spec requests String type for Object's key (property name). 3 bytes shorter looks charming, however. |
Well this is always tempting to squeeze the juice out of format which sole purpose was to compress space. |
I guess this could be done with a small change. https://github.com/kawanet/msgpack-lite/blob/master/lib/write-type.js#L242 keys.forEach(function(key) {
var intkey = key | 0;
encode(encoder, (intkey == key) ? intkey : key);
encode(encoder, value[key]);
}); It's not tested though.
|
It seems B or C would be better than A to get compressed. Solution A: using Integer map key instead of String map key. Solution B: using gzip compression after encoded. Solution C: using Array instead of Object container. |
Agreed. Without an exemplary use case A is just a premature optimization. I can think of one example from my past, an application that used a multi-dimensional vector |
Thank you for great library!
Now, I have a trouble that a converted binary is different from other library.
I am unsure of msgpack, so, I could not know which result is right or my json data is wrong data.
I am sorry about my bad English...
Source json data
Converted binary from http://kawanet.github.io/msgpack-lite/
Converted binary from http://msgpack-json-editor.com/
The text was updated successfully, but these errors were encountered: