Gen vs javascript (vs Max ?)

    Aug 11 2020 | 9:44 pm
    Hello, someone has some informations about the efficiency of gen (event domain gen, without ~) respect to js or native max objects? In particular, does gen has the same problem of low priority in the scheduler as like as js? Thanks in advance

    • Aug 12 2020 | 3:49 pm
      Hi Mattebass, I don't know but I'm interested in hearing. You might be interested in trying out Scheme for Max, which allows you to do your code in S7 scheme-lisp and runs in the high priority thread (if triggered in the high priority thread), ie same threading as normal max and no auto-defer low like in JS I plan to add functions to control the threading better in upcoming releases too. Info here:
    • Aug 12 2020 | 10:29 pm
      someone here on the forums once said that javascript would be about 50 times slower than processing messages in max.
    • Aug 13 2020 | 1:25 am
      These sorts of things really depend on what you are doing, but in my benchmarks of some really simple operations (counting up to 1million and multiplying each count by a float), I only see about a 3 times speed decrease from plain max to JS. This is with both running in the UI thread. Basically the same operation is 450ms in scheme, 500 in js, 175 in max (uzi, counter, *). I haven't tested Gen though
    • Aug 13 2020 | 2:54 am
      FWIW I figured out how to test them running from the high priority thread, and this lowers the JS performance a bit, presumably from the deferred low call under the hood. But roughly the same.
    • Aug 13 2020 | 3:23 pm
      Thanks for the answers. In particular I was tying to figure out the usefulness of gen compared to javascript, and maybe the reason is based on gen's better performance. Moreover, I was trying to figure out what computational advantages could provide gen, because if gen~ works on a per-sample way, it's not clear how the as-fast-as-possible paradigm of regular max object could be improved by gen. Anyone has some empirical knowledge about this? Thanks again
    • Aug 13 2020 | 3:31 pm
      I have not used Gen much, but in a nutshell, Gen code compiles down to C++ under the hood, so when you run it, it's running much like an external. So it should run much faster than JS (or scheme) as there is no interpreter overhead, especially for certain kinds of operations.