JSON.parse() is much slower in the js object than the node.script object.

Craig Latta's icon

I've written a M4L device for controlling the Live API from a MIDI mixing control surface connected through a web browser. It processes MIDI traffic as JSON from a node.script websocket. I've noticed that JSON.parse() is much slower in a js object than a node.script object. With the parsing done in the js object, the overall message processing bandwidth is about a fifth of what it is when the node.script does it (leaving the js object to deal with Max Dicts). I suppose eventually I'll translate my js application logic to Max objects, and things will be even faster.

How do folks profile the performance of the js object on macOS? I'd like to quantify a simpler example for Cycling '74 support.

It's fun returning to Max after learning it from David Wessel and David Z. back in the day at the UC Berkeley music department's CNMAT! It's great there's a relatively straightforward round-trip data path between web browsers and Live now. Dealing with UDP and Python in the past was rather a hassle.


cheers,
Craig