-
Notifications
You must be signed in to change notification settings - Fork 54
Switch from msgpack-lite to msgpack-javascript #132
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
Conversation
See RobotLocomotion/drake#17861 for a detailed description and analysis. We've seen approximately a 10x speed up in demarshalling approximately 30 MB of scene data. This includes a small refactor of the handle_command to allow decode() to be called directly (since consumers of the Viewer might want to use the additionally defined msgpack types). Also fixes a small bug with accumulating camera/light controllers.
Resolves RobotLocomotion#17861. Depends on meshcat-dev/meshcat#132. Importantly, I've also exported the msgpack requirement via meshcat.js, so that we don't need to build it again ourselves here. msgpack-lite included the msgpack.min.js in it's github distribution, but msgpack-javascript does not. I would have needed to pull it from some CDN or NPM server, or build it locally (which would require node as a dependency). Also fixes a bug when setting PerspectiveCameras.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! I'm glad there's a better option nowadays
const to_return = new Uint32Array(data.byteLength / 4); | ||
let dataview = new DataView(data.buffer, data.byteOffset, data.byteLength); | ||
for (let i = 0; i < to_return.length; i++) { | ||
to_return[i] = dataview.getUint32(i * 4, true); // true b.c. littleEndian |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still surprising that a JS loop over every byte of data could somehow be performant but 🤷 V8 is magic
This update includes my recent meshcat PR meshcat-dev/meshcat#132, which switches meshcat to using msgpack-javascript instead of msgpack-lite. Resolves RobotLocomotion#17861. Importantly, I've also exported the msgpack requirement via meshcat.js, so that we don't need to build it again ourselves here. msgpack-lite included the msgpack.min.js in it's github distribution, but msgpack-javascript does not. I would have needed to pull it from some CDN or NPM server, or build it locally (which would require node as a dependency).
This update includes my recent meshcat PR meshcat-dev/meshcat#132, which switches meshcat to using msgpack-javascript instead of msgpack-lite. Resolves RobotLocomotion#17861. Importantly, I've also exported the msgpack requirement via meshcat.js, so that we don't need to build it again ourselves here. msgpack-lite included the msgpack.min.js in its github distribution, but msgpack-javascript does not. I would have needed to pull it from some CDN or NPM server, or build it locally (which would require node as a dependency).
This update includes my recent meshcat PR meshcat-dev/meshcat#132, which switches meshcat to using msgpack-javascript instead of msgpack-lite. Resolves #17861. Importantly, I've also exported the msgpack requirement via meshcat.js, so that we don't need to build it again ourselves here. msgpack-lite included the msgpack.min.js in its github distribution, but msgpack-javascript does not. I would have needed to pull it from some CDN or NPM server, or build it locally (which would require node as a dependency).
It turns out that meshcat-python was using the `handle_command_bytearray` entry point for the static html content. My PR meshcat-dev#132 broke that (sorry!). This restores that interface and functionality.
It turns out that meshcat-python was using the `handle_command_bytearray` entry point for the static html content. My PR meshcat-dev#132 broke that (sorry!). This restores that interface and functionality.
…omotion#18269) This update includes my recent meshcat PR meshcat-dev/meshcat#132, which switches meshcat to using msgpack-javascript instead of msgpack-lite. Resolves RobotLocomotion#17861. Importantly, I've also exported the msgpack requirement via meshcat.js, so that we don't need to build it again ourselves here. msgpack-lite included the msgpack.min.js in its github distribution, but msgpack-javascript does not. I would have needed to pull it from some CDN or NPM server, or build it locally (which would require node as a dependency).
See RobotLocomotion/drake#17861 for a detailed description and analysis. We've seen approximately a 10x speed up in demarshalling approximately 30 MB of scene data.
This includes a small refactor of the handle_command to allow decode() to be called directly (since consumers of the Viewer might want to use the additionally defined msgpack types).
Also fixes a small bug with accumulating camera/light controllers.