MeshSelector - abs_threshold_ computing time

Hi @chris,
Glad you released the MeshSelector component. Thanks for that.
Testing it i have a question/thought/wish regarding the computation time it takes for the abs_threshold_ input to calculate.
For some cases, like the sample file, it takes the same time to calculate as the Radiation itself (in my machine is like 8-9 secs).
In another example it runs fine time wise.
It is probably related to the grid size and finally the number of faces in the mesh.
The _pct_threshold_ calculation is fast in either case.

This post is more like a wish than anything else: To find a better algorithm to calculate the abs_threshold. I can see cases that it can take very long times to finally get computed.

Thanks!!
-A.

2 Likes

Hi,
Attached the sample file. I put in there the workflow that i use to cull the mesh/results just in case you want to compare the approach.
While the MeshSelector takes 10 secs, the workflow does it in no time.
Thanks,
-A.
radiation_study_Culling-AY.gh (61.1 KB)

1 Like

Hey @AbrahamYezioro ,

I’m not sure how it’s taking so long to run on your machine. It’s pretty much always under a second on both of my machines and this is the slower one:

Are you using Rhino 6? The code for the abs_threshold_ is almost exactly the same as the legacy component. Are you able to get similarly long runtimes there?

Hi @chris,
This is weird. The absolute input takes a lot of time in my machine while the pct is very quick.
Well … i’ll keep tracking.
I’m using the latest R7 version.
Thanks,
-A.

1 Like

One other thought, @AbrahamYezioro . Does it take a similarly long time to use conditional statements on any of the components? That could help me understand if it’s the result a specific python method that I am using.

Hi @chris,
There is something in what you said. See this:


The conditional statement is taking more than 4 times (for this case) than without … on my machine (which is supposed to be a strong one).

Thanks,
-A.

Hey @AbrahamYezioro ,

In this case, I can pretty conclusively say that the issue is because both of these components use the native python eval function, which is the magic that underlies the ability to process all different types of conditional statements. You can see that this is where it’s used in the Mesh Threshold selector:

I’m not really able to recreate it on my end. Granted, the conditional statement takes longer than the one without the statement but both are really quick:

What generation is your CPU (eg. i5, i7, i9)? If it’s an i7 or above, then maybe there’s some sort of security protocol that’s preventing your machine from running the eval statement efficiently. The way that we use eval in Ladybug Tools is very safe but I know that some people criticize it because the same freedom that supports the evaluation of lots of conditional statements can sometimes be used to hack things if it’s not used safely.

Hi @chris,
My CPU is i9-9880H CPU @ 2.30GHz, 2304 Mhz, 8 Cores, 16 Logical Processors.
Probable too much information, but wanted to be accurate in the description :slight_smile:
-A.

Hm. Your processor is pretty good and somewhat similar to mine. My CPUis also an i9 but it’s 3.3 GHz. Perhaps the GHz partly explains why the computation time is so different but it does feel like something else is at work here.

Hi @chris,
I also have the feeling that something else is happening on my machine. Wonders of WindowsOS.
I’m considering reformatting, but … :worried: hard to find a good time to do that.
Thanks,
-A.