GH Python is running too slow... why?

Dear experts,

The Python component takes more than 2 seconds in computing simple statistics from just 220 numbers list: (13.5 KB). However, it should take just a few milliseconds instead…

Why is this so? What am I doing wrong? Thanks!

It should only be slow when you first open the definition and the GHPython component executes the first time. If this is not the case, we’d need to know more about your setup (i.e. Rhino version etc.).

Edit: There’s definitely something fucky going on here. On my system the compute time increases each time the component executes. Perhaps it’s a memory leak related to the statistics module.

Hi, thanks for the quick response!

You´re right, the first time it takes around a couple of seconds, the second recomputation drops to a few milliseconds (as it should be), and next ones steadily increase run time. It is quite weird.

My Rhino version is 6 SR25. Please, let me know if you need anything else?

Perhaps I should use a different statistics module… any recommendation?

Hi @Vigardo

as you figured out yourself, this is likely a statistics module implementation problem. Maybe you could change the title to something more specific to attract more specific help.

To solve this, you can investigate what is going on, or try another module. I’m showing how to use .Net Numerics here, but for another purpose.

Means and medians are easy to compute in steps, too. And it could be a fun little exercise.


Giulio Piacentino
for Robert McNeel & Associates

Hi Giulio,

The speed problem is not so bad at this moment, just a bit annoying :slight_smile:. I thought that it would have some straightforward solution but it seems some kind of bug.

As you said, such basic statistics are easy to compute so I will code them from scratch at some point. I think this will be the fastest approach.

In any case, when I have some time I think I will open a new more specific thread, just as a possible bug report in the statistics module.

Thanks a lot for your kind help!