Grasshopper

algorithmic modeling for Rhino

Hi Guys,

Which solution computes faster between a custom C# component and a compiled GHA plugin? Just wondering if it is worth going to Visual Express to accelerate a script that is a bit too slow.

many thanks,

Arthur

Views: 965

Replies to This Discussion

There is no runtime difference between a C# component or a C# GHA, provided it is the same code. There is however some overhead involved with C# components. The first time they run they need to be compiled (this can take up to several seconds, but it needs to happen only once for the same code), and there's also some extra casting and data copying that goes on. This is not -necessarily- the case for compiled GHA components.

I can tell you though that if you're looking to speed up slow code, you can probably do much more worthwhile things than move it into a GHA file. You need to profile your code so you know where the bottlenecks are and then focus on fixing those.

You an use System.Diagnostics.Stopwatch to reliably and accurately measure time between two points in the code.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks a lot David,

I will try the Stopwatch, sounds promising.

Nice post to improve code :) Thanks David for the tip.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service