Forums > Javascript

Using classes and JS performances ?

June 24, 2012 | 7:57 am

Hi there,
are there some advices to use or not use classes in js executed in jsui ?
I’m building a small gui for myUniverse project with jsui/mgraphics and it would be useful to define some classes like vec3f, things like that.

June 24, 2012 | 4:22 pm

Well, I’ve never avoided classes – in fact, I love ’em. As long as you aren’t too kooky about the number of instances you create, you should be in good shape. Since internal to Javascript the classes are just variations on function pointers, you shouldn’t see a real hit to performance (this is just based on experience, not any specific knowledge of the turning gears in the system…).


June 24, 2012 | 4:35 pm

Hi Darwin and thanks for your answer.
AFAIK, the JIT compiler processes the javascript and indeed it is VERY fast.

Your informations are precious.
I’m building the GUI of myUniverse system :)
Initially wanted to keep that outside of max and linked via OSC, but finally, integrating it right now inside Max!

June 25, 2012 | 1:58 pm

i’m using lots of classes in JS and no problems at all.

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

Forums > Javascript