msgpack / msgpack

MessagePack is an extremely efficient object serialization library. It's like JSON, but very fast and small.
http://msgpack.org/
7.01k stars 521 forks source link

Is msgpack.wasm available ? (webassembly version) #273

Open xosg opened 5 years ago

xosg commented 5 years ago

Hey, hello Could u make a WebAssembly version of msgpack.js ? For 3 simple reasons:

  1. 50KB of javascript version (msgpack.min.js) is a little bit big ....
  2. webAssembly is also binary version just like msgPack, which makes some sense....
  3. encoding & decoding between msgpack and js object is pure function, which make wasm version easier.... THX, i look forward to it :)
xosg commented 5 years ago

reason#4: msgpack supports almost 100 languages just EXCEPT webassembly... :)

bhgsbatista commented 5 years ago

You could built your own using emscripten pretty easily from the C/C++ implementation. Give it a shot, it would probably be a fun project :)

aep commented 4 years ago

you mean with the same js api? should be easy to implement from the zetz port i'm working on atm if you still need it?

torchesburn commented 2 years ago

Anybody still looking at this? or is there a better alternative at this point?

mlsomers commented 2 years ago

You can build a webassembly with many languages, for example Razor is a webassembly framework for .Net, so you could use c# and my LsMsgPack lib to build a webassembly version.

However a loose webassembly MsgPack serializer/deserializer dos not make much sense on its own, it would typically do something with the data before communicating with the webpage.

The interaction between a webpage and webassembly is via javascript POST and GET... it's a local webserver hosted inside the webbrowser, and can offload processor intensive tasks to the client instead of doing it on the server (for example generating PDF files or manipulating bitmap images).

Webassembly is more like a virtual machine than a "language", and can be built in many languages, so the question is not really valid.

markusschaber commented 2 years ago

I'm not sure how a WebAssembly version with an emulation of the messagepack.js Api will benefit anyone. MessagePack is used to serialize and deserialize objects into byte streams. To use an WebAssembly implementation of MessagePack from JavaScript, you need to pass the objects between JavaScript and WebAssembly. Which usually means JSON serialization and parsing on the other side. So my guess is that any efficiency gains you might get by performing the MessagePack work in WebAssembly will be more than neutralized by the extra JSON roundtrip needed to pass the objects between JavaScript and WebAssembly space.

Of yourse, in case you use WebAssembly to run code of any "non-browser" language (like C / C++ / C# / Rust etc.), you should also use the MessagePack library for the given language.