OPs vs. Script Cook time test

Hi,

I have to define the algorithm to calculate angles. Considering that I have to do it lots of times each frame, I’m looking for the fastest way I can find.
I’ve found in here: derivative.ca/Forum/viewtopic.ph … ion#p14462 a comment that says that OPs can be faster than scripts.

I am an old style soft writer, so I prefer to write scripts rather that OPs (I’m new to all this), but I translate the algorithm to CHOPs to see the difference and I found some problems:

I put each method on a different container, so I can calculate each containers cook time, but I can’t find the way to put it on screen. The only way to see cook time was Middle Mouse Button on Container, but even there I found strange reactions.

  1. First of all all test found that script is faster than CHOPs. (although I have to say that acos function surprised me… It’s really fast… maybe you just use a table? )
  2. Each time I reload .TOE cook times change and remain the same since I close and reopen Touch, so I can’t found the way to monitor each frames cooking time… (seems that Touch calculates cook time only first time and then repeats that number)

Then in the OPs version I try to do another version with Pythagoras using Math OP “length” to see if I can found a faster way to find hypotenuse, but I don’ understand how to use it.

How can I put “real” cook time of each component on screen? I want to see haw much it changes each time…

I’m using Touch 088 64-bit 12400.

Test angulos Comparados.rar (14.7 KB)

:astonished:
Hi there…
Nobody knows how to read cook time inside a script…?

Hi Manuel.
To get the cook time of an operator (example “/project1”) :

In tscript: opinfo(“/project1”, “cook_time”)
In python: op(“/project1”).cookTime

If the cook time is not changing, it likely means the operator is not cooking that frame.
Operators only cook as needed.

To see the total number of cooks use:

tscript: opinfo(“/project1”, “total_cooks”)
python: op(“/project1”).totalCooks

You can get all these info in a CHOP directly by using the Info CHOP.

Note however: cook time for an operator is only that operator, it does not include the time of all its children, though we are testing a solution for that in the experimental builds.

We don’t use a table for acos, we just use the built in standard c math library for our trig functions.

Cheers,
Rob.

Thanks…
Tonight I will try!!!

I had a poke around with vesabios’s script from this thread
[url]saving gpu ram! - #3 by Leskos]
and made a component that gives you the total cook time, and a table of cook times for all operators inside a component. Still a little rough around the edges, but can be adapted.
performance_analyser.tox (1.96 KB)

Nice one. You probably also can use the perform dat and a select dat to get all cook times from nodes in a certain comp

Yeah, that is a whole bunch simpler and more elegant isn’t it! Haven’t used the perform DAT before, was each op’s cook time always logged? (recently downloaded experimental build 16260) Ah well, was kinda satisfying to do it the long way round…