Forums > Max For Live

Speed of max with javascript

October 16, 2012 | 6:45 am

I read a topic somewhere about someone wondering why people were using js instead of java with max, even though java was hundreds of times faster.

How fast/slow is the use of javascript exactly? Is it wise to even use it? I have no intention of doing any audioprocessing with it, just pure midi.


October 16, 2012 | 6:47 am

(Oops, put it in the wrong category)


October 16, 2012 | 9:43 am

Hi Pvdn !!!
did u saw it ? http://cycling74.com/forums/topic.php?id=4492 . i had problems with huge amount of iterations , js even hanged my max :/ but with relaxed flow its working pretty well .
ive read somewhere (cant find the thread) that we should not rely on JS considering time sensitive operation ,there is small (but present) latency around 1 .. 5ms .


October 16, 2012 | 10:06 am

I’m only doing some minor stuff: reading/setting the states of ui-elements, creating objects, storing/reading some internal data, etc.

By the way, I did some quick reading and was wondering: do you even have access to the patcher using java as with js (i.e. can you create or look up objects for example?).


October 16, 2012 | 10:13 am

#1 . im using JS for a very very similar operations ,and im happy with JS untill now :)

#2. im pretty sure that you can do the same and even more :)


October 17, 2012 | 3:00 pm

JavaScript, especially in Max 6, is pretty fast. The slowest part is usually to get in/out of the object. In the example you mentioned testing with uzi is not really the best use of javascript, a more fair comparaison would be to have the loop inside the js object.
It’s worth mentioning that it also depends how you write your code. For instance, using global variable can be significantly slower than using local variable.


Viewing 6 posts - 1 through 6 (of 6 total)