TOP to Chop eating frames

hi, i know that there have been topics about this question already, but they did not really solve the problem (for me at least):
i need to have four analyze-tops in my project. i’m getting data from them using four top to chops which are slowing down my framerate by around 10 frames. they are at up to 7ms cook time.
what i also dont understand is that the cook times of the four top to chops are not the same, even if the settings are completely identical.
i’m feeding only a 1x1pixel source but it doesn’t help.

are there any suggestions how i can save me framerate? is there another way to get infos from the anaylze top?

thanks alot
jonathan

Hi Jonathan and welcome to the forum!

So, I did this tox to push it a little bit - 100 TopToChop and the results are interesting in a way and not surprising in another

TOPtoCHOP_cooktime.tox (4.0 KB)

Method 1 - yours: I’m sampling just 1 pixel in a constant Chop (for convenience for the 2nd method also 1 pixel, but in this method it doesn’t matter)

      - the First TOPtoCHop is always twice as slow as the next one and the results are not that consistent for the first say 4 Chops. I guess it's smth to do with internal working initializing and "cloning"
      - then it's pretty much consistent for literraly 100s of Chops.

Method 2 - unite and conquer - this would be my way of doing - sampling all at once. Laying out the tops in the row (hence the 1px top) or other layout and sampling it all once. Hell, you can have a 3d texture too if layout is too large. The gains are … well… massive. Depending on your needs, it could be better to use GLSL compute shader to lay out the pixels in the way you want and converting it all at once with 1 TopToChop imho. Just an optimization conundrum.

Best
sH

this is very interesting, thank you very much for the test! I actually had a similar idea: I layouted the for analyze-tops (I need to analyze them seperatly) and had then a 2d-toptochop, which I converted into a table in order to get the columns one by one. this works, but the toptochop is now even slower as before.
i’m a doing a mistake?
thanks alot


Hey,

This is way too excessive for 4 samples, for the life of me I cannot get it that slow even if I wanted to. Do you mind sharing your .toe - the relavant part of it (what’s in the picture).

What’s your hardware? TopToChop if I’m not mistaking is coded in C and is quite fast, especially if you’re not trying to convert the full high def image in channels and dmx which is rarely require. I recently had 271x271 pixels RGB texture converted for volumetric LED and it was on order of 0.04ms (W11, 4070 laptop here) and half of it on the desktop server (w11, a6000).

I can test it for you here as it is to phase out hardware issues.

dear _shandor, thank you for helping me on this. Its actually very mysterious: when I copied only the relevant part to a new project, there was no problem anymore. But in my original project, the cooktime is still very high. I don’t understand from which part it is depending.
Attached you can find the project. I deleted everything I could. Since you don’t have my MIDI controller, I set a list of constant chops to the MIDI values. The problematic part you find in “scene3”.
I would be really happy if you could help me because I’m quite desperate at the moment (deadline is coming closer…)
thanks!

10-01_share.toe (105.7 KB)

this is my computer

Hi Jonathan,

Happy to help… if I can. I’m a little bit allergic to Macs, I must say and it’s not a viable development environment imho, but no judging (well, maybe a little bit :).

When I opened it on my laptop, your cooktime is peachy (nice UI, btw):

Perform mode:

Edit mode (found you TOPtoCHOP op):

As you can see, your cooktime of this operator is decent.

If you’re looking for the ways to optimize it (attached the file) with the biggest bang for your bucks:

  1. The new way of working with multicamera setups, it’s using 1x Render (instead of 4x in your setup) and then just RenderSelect the cameras. You’re using it in several places and by just doing that, the frame time dropped by 2ms.

  2. It’s a good practice to use geometry instancing for everything you can (shifts load to GPU instread of CPU). You can also use texture instancing (look at the snippets of the GEO Comp) for mapping your different textures on instanced geometry.

  3. You should probably think of a way to optimize UI a little bit too grid-wise. More multirow components (table? lister? I know :slight_smile: ).

  4. There’s also smth to say about priorities of execution (I mean foreground/backgroud). Put the switches Always on Top on On and Allow minimize on OFF to get the most to keep the priorities high and not let the window go on background. No idea how it is managed on Mac, but on Windows it can be vital.

  5. Turn all the op viewers OFF. it takes a lot of power to render.

  6. Be aware of interpolations: you’re sampling just 4pixels which are all interpolated with input smoothness. I have put all the chain of those operators inputsmoothness (and viewer smoothness for that matter) on Nearest pixel settings to preserve their values throughout the chain.

  7. You can composite better all 4x renders in one go and just sample in the right places with sampling coordinates. (look at the Top to Chop snippets).

10-01_share_mod.0.1.1.toe (516.3 KB)

All in all, it’s very cool UI with a nice project and my small optimizations have nothing to do with ToptoChop, but your system is quite complexe and you never know what makes it unstable or laggy, besides turning it on Mac (sorry, can’t help it :wink: ).

Hope it helps to move forward

Best
sh

dear shandor,
thank you so much for all of your work! actually, the renderselect made the difference. I don’t know why my machine was not able to handle the toptochop but now it works! perfect.
I’m a bit allergic to windows too, hahaha
I’m always a bit unsure if Touchdesigner is tapping the full potential of my mac. It is actually a quite powerful one. In terms of UI I can say, the TD is not yet mac-optimised yet! But I won’t complain, I’m happy that there is a mac-version of this beautiful software.

I tried to follow all your optimization instructions. Only point 7 I did not understand. And thanks for your compliments about my UI :slight_smile: I’m also very happy about it. (in real life it looks of course even much better, the fonts were missing at you computer and you didn’t have my controller…)

thanks again, have a nice weekend and greeting from germany
jonathan

Glad to hear it’s working for whatever reasons.

About Windows, it’s all cool my friend :slight_smile: I just think you’re missing out a lot of performance and windows only features which are quite a lot. It’s much more open plateforme than Mac and the architecture allows to mutli-gpu, superspeedy servers. This is literally what we do for each of our istallations: tailor the hardware for - you need 4x Quadro - no problems, you don’t need it - no problems either. Speedy Nvme, connectors, memory, add-ons cards… You can custom tailor each part for your needs and it doesn’t change every year so you need to recompile your shit every time. Just saying :wink: And did I metion all the “windows only” features related notably to Nvidia?

What about the last point of optimizine, you my want to compose everything in 1 big comp and skip intermediary steps (OVER Top and Composite Tops) and just do one big Layout Top (with scale on) and passe UV coordinates to TOPtoChop as it is in this snippet:

Of course, if you passe multisample Chop, it will be sampled at each sample point.

Cheers
sH