JS vs pure patching

    Oct 14 2011 | 10:34 am
    hi folks, I'm currently designing a probabilistic sequencer for my own use, firstly.
    I'm hesitating between a JS core which would retain all arrays of data (or almost all) VS pure patching objects (coll, etc)
    Of course, time accuracy is totally required. So I'm hesitating before diving into one or the other solution and I'd want to have your opinion.
    of course, I tested the beta Max6 and the javascript seems to be improved (tested with a couple of existing projects I had.
    best, j

    • Oct 14 2011 | 4:36 pm
      I don't know this for sure, but if you're using arrays, wouldn't jitter matrices be faster than either coll or js?
    • Oct 14 2011 | 4:38 pm
      I decided to go to JS. Trusting the new engine in Max6...
      Translating it into coll or even jitter matrices wouldn't be that hard
    • Oct 16 2011 | 9:16 pm
      Considering HUGE max 6 improvements, I guess that JS worth to be used..
      I'd like to know more about performance comparison between: - 1 JS parsing A LOT of data coming from 8 sources VS - 8 JS parsing data coming from 1 source each one
      I really wanted to know that.
      Best, j
    • Oct 16 2011 | 9:23 pm
      posting that in JS forum... more appropriate..
    • May 03 2012 | 8:46 am
      I would love to hear about this as well. In Max4 I used javascript quite a bit but eventually disliked it mainly for performance reasons. I moved to Lua and C from there but recently I got back into Javascript for other domains.
      For a new project I'd like to implement a midi processor/mapper in javascript so I'm also worried about timing and performance.
      Julien, what are your findings so far?
    • May 03 2012 | 8:56 am
      Hi, JS in Max6 is REALLY faster, first good point. I'd suggest you to prototype first using Max6 Objects, if possible (sometimes, making multiple included loops or more tricky stuff can be a pain following that way) Then, if it works, keep it. If it doesn't work well because of complexity of patching work, move to JS. This would be my way.
      About Externals. Indeed, if you can code C++ routines using the SDK, I'm quite sure it would be the fastest way. I wrote "could be", because I have been very surprised by some part of my patches using JS in Max6.
    • May 03 2012 | 8:08 pm
      I know where the weakness of visual programming lies, and when it pays off to move to procedural. The question is more whether I should give JS another try or stick with what I already know is good. I think from your experiences I should give JS second chance.
      I forgot one major JS annoyance. The missing module system. I had a look and I still can find no docs on any sort of require() function in Max6. It is possible to break JS code into modules now or is the jsextensions folder still the only way to reuse code?
    • May 04 2012 | 12:00 pm
      Hi Thijs,
      Luke hall published a script (hallluke.wordpress.com/2010/10/31/including-extra-javascript-files) using the eval() function to include js files into a project. (it not really elegant but it works until Max5). In Max6 though the implementation of eval seems to have changed so the old script doesn't work anymore. In this thread (https://cycling74.com/forums/how-can-i-fix-the-error-message-scope-eval-is-not-a-function) there is a discussion about some modifications to the script to make it work. (probably even a bit less elegant as functions are passed around a lot.. ). I would be very curious to hear if some else found a better solution. So far I go for Java if scripting project get to large. Jan
    • May 05 2012 | 10:40 am
      That's too bad. Thanks for the tip about eval but I'd rather stick with jit.gl.lua for scripting then. NodeJS has a module system using require() which works nice for server side code. The browser on the other hand loads all scripts in one global space, and then you can quite easily create modules with some namespaces and immediate function wrappers.
      A missed opportunity in Max6 imho. Now we have a fast engine and no real way to reuse code or write bigger projects. It was like this in Max4 and years after things are still the same. Bummer.