scripting in max/ processing speed

johannes's icon

hi, i like to learn a scripting language for bigger calculations, storing big data structures, matrice processing etc ...
does python, javascript, ruby and lua differ regarding its processing speed?
experiences, alternatives, recommendations are welcome.

thanks, johannes

nick rothwell | project cassiel's icon

Short answer: yes, they differ in processing speed. (Also, should it matter, they differ regarding whether they will run in the scheduler thread, although I'd make a guess that you don't need this.)

It's hard to be more specific without knowing what you're trying to achieve, but to be honest I'd factor in the suitability of each language to express what you need, and support it in a computational-complexity-efficient manner, at least as much as raw performance.

As a very rough rule of thumb for the JVM-hosted languages (Java, Python, Ruby) the cost of moving stuff to/from Max is quite high, but the compiled code is pretty fast. (Python is probably the worst of the lot for raw code speed; Java and Clojure are probably the best.)

johannes's icon

thanks for your reply, nick.

well, i like for example execute functions, within i compare the content of one matrix agains another matrix, or with a
lot of conditions in it… or multiplying one matrix data (10000 * 2) by the content of another matrix(10000 * 2) , than calculating different
other operations on it. would that be be a problem with a script language like ruby or python if i would repeat the calculation each 50 ms?

it just came to my mind that i found matrix processing very efficient in supercollider. but following the sc3~ helpfile, the object doesn´t cover
communication from sclang back to max/msp... ciao, j