Hi. I needed a sub-millisecond probing suite, so I took TomTom’s Bottleneck Finder, changed the output to ticks and added a few simple comparison methods. I hope it proves useful to anybody who stumbles upon it.
How I can find in the canvas the most resource intensive component? The “out” on the second row it gives an index of the component? How I can use that index to select the component using Metahopper or another component?
It’s component’s number on the canvas. See this as ‘component has been added the Xth’.
This should allow you to select an object by its InstanceGuid and also get Metahopper-friendly object strings. I can’t test Metahopper myself right now.
Edit: the slider’s domain is currently set by hand. You can just edit the slider’s max value to your liking or set to, say, 500, and that should suffice in most cases. Or replace it with a writable panel. I can make the slider’s domain react to changes in component count, but not right now.
I would not consider that this has been mine at any-time. Calling 2-3 internal functions is not really a big achievement. But thanks for the credit
Other than that, I think to do proper performance profiling in .NET is not as straight-forward (without the right tooling).
This is because you need to consider, that computation times can greatly vary if you view the entire picture. Also identifying the true bottleneck is a bit tricky. This is why Benchmarking frameworks repeat the process multiple time, trying to isolate the function as best as possible.
Especially because in NET the Garbage collector can greatly disturb the performance.
Under this assumption, resolving computation times under milliseconds, is not helpful. Because a performance drop can be the subject of something going on in parallel. Maybe every-time the code is executed. Lets say the Garbage collector frees a lot of memory as a consequence of data piping, the moment your performance critical code is executed, you might get the impression that the bottleneck is your code. Instead the main/ui thread is just under heavy load for the wildest reasons.
If doable, you could develop code using Visual Studio and use the inbuild profiler to understand bottlenecks down to each line. However this requires a bit of setup and some architectural decisions on your own code-base.
The latest version allows one to set a potential culprit on a timer and probe it repeatedly, and also if the whole selected group updates dynamically upon a slider’s value change (my case).
I’ve seen unexpected “chokes”, but so far I’ve been able to identify the components that slow the process down quite reliably. And from what I understand the sheer amount of components - used or unused - affects the performance severely. Even if they are completely disabled…
I don’t really understand from where to begin. I’d say it’s very much above my skill level, but I am curious. To which profiler do you refer? How am I supposed to understand bottlenecks down to each line, if the Grasshopper doesn’t expose the internal code of the components?
I’m referring to the Visual Studio (not VSCode!) Profiler. It’s integrated in the IDE.
It’s a topic on its own, but once you get an understanding on how it works and what you actually observe, it’s a very useful tool. There are alternatives to it. But it’s by far, one of the most insightful profiling tool, I worked with. You can detect all sort of issues down to each line of code.