Hello all,
Just wondering - If I have a function that is computationally intense, does Codea’s drawing 60 times a second slow that down? Is the draw function in a separate thread, and therefore not affecting things? If the draw does affect the performance of other functions, is there a way to improve the situation? Thanks as always!
The computationally intense function won’t slow down, but the number of times the draw function runs will slow down. If the function is really intense, the draw function can go from 60 times per second to a couple of seconds per draw.
Yes, it will affect performance. AFAIK, Codea is single threaded when it comes to calculating and drawing.
After checking there is no way to improve the function performance, one way of addressing this is to only update the calculations every X frames, and to spread the calculation over those X frames.
If you give us some idea of what your function is doing, and how the results are used, we can be more specific.
If I have a function that is computationally intense, does Codea’s drawing 60 times a second slow that down?
I’m reading this as you don’t care about the speed of the drawing, just of the computationally intense function. No, Codea’s drawing won’t slow the other function down, it’s the other way round, the other function will slow the drawing.
Thanks all. I’m creating an application - mainly educational in purpose - that allows the user to load matrices (say, from the UF Sparse Matrix collection), view them, edit them, see how various compression algorithms work (visualizing the data structures), time various operations (compression time, matrix-vector multiplication), compare the performance of different compression algorithms, etc…side project for a professor of mine…
If I time, say, 1000 iterations of a particular matrix vector multiplication, that is an example of a computaionally intense operation. It was in this context that I wondered about the effect of draw(). @yojimbo2000 you are correct: I would not at all be interested in the the draw performance during the computation…I realize that Codea is optimized for drawing and not necessarily for scientific stuff - nevertheless, the visualization and interaction potential is high (not to mention quick to produce) with Codea/Lua, as we all know…