[ANSWERED] Calculation overhead: Javascript vs calculators
-
I have a quick questions about system overhead as I embark of a patch that will be replicated many dozens of times. Is the overhead of using Javascript greater for doing nestled math calculations vs stringing calculators together in a user actor to do the same calculation?
A couple of examples of a math formula that I am using would be:
B = ((T - 1) * 18) + ((P - 2) * 2) + 1
L=((P−2)mod3)×32+1
It much easier to put these together in Javascript, but I can do them with calculators if its quicker.
Thanks, J
-
It depends on the amount of replications and this is such a deep technical question that we really have to dive deep into the codebase to figure this out for you :)
For example I dont know or JavaScript code that is in memory needs to be re-initiliazed. -
@juriaan Ahaha. Understood. I thought it might be a simple answer. I know you have much more important things to do. I will just try some stuff and see where I end up. Thanks for reponding.
-
Happy to dive deeper with you, but I dont have an answer for you at this moment.
Will do some testing on my own and report back
-
-
@jtsteph said:
It much easier to put these together in Javascript, but I can do them with calculators if its quicker
When we first added the Javascript actor, I did a series of deep tests to determine exactly this. What I found was that I could use hundreds/thousands of JS actors doing math and still have good performance... and I could also use Thousands of the Calculator actors.
I suspect you will have very similar performance either way, however; I believe a series of Calculator actors will be slightly less heavy.
Due to the nature and easy of doing this in JS, I would personally use JS. But you could easily build both and use a global to switch between the methods used.. allowing you to make a change if performance required it.
-
@dusx Thanks. Given this, as most of my calculators are used in momentary situations (button press, dial turn) I think that Javascript makes more sense. It greatly simplifies my patching. If I run into a situation where they are updating as a stream, I'll try to use calculators.
I appreciate your input.
Best, J