manipulating matrix cells within javascript

joonybangol's icon

Hi,

I'm coding several javascripts, which are sending and receiving matrixes between each other after manipulating them. Now I want to optimize my code for better performance. I tried to use jit.op or jit.expr as much as possible, but sometimes couldn't avoid using getcell or setcell, and I guess it's slowing down performance speed. In Java tutorial, I read that getcell and setcell are expensive, so there's another methods such as copyVectorToArray or copyArrayToVector.

So, my question is, is there any alternative way to get matrix data into array and then send back within javascript which is faster than getcell or setcell?

Another question, how should I use jit.fill or jit.spill within javascript? I cannot find any document about them.

Thanks in advance

Joshua Kit Clayton's icon

Sorry, but jit.fill/spill don't work within JS, and there's no more efficient way like in Java. You'll need to use op, expr, or move to Java or C if you need better performance. If you post an example of what you're struggling with, perhaps we could offer some advice of how it might be possible with op or expr.

joonybangol's icon

Thank you for reply, Mr. Clayton. You made it clear. I'll try it as you suggested and ask again if I need further help. Thank you.