Grasshopper

algorithmic modeling for Rhino

Hi guys,

i've been searching through the web, but i found nothing.

Does the exact same script run faster depending on the language it is written in?

Thanks,

Edo

Views: 220

Replies to This Discussion

It could. C# and VB are compiled to MSIL and then jitted to machine code, whereas Python is interpreted, although very cleverly.

Python performance is typically somewhat lower than C#, and even VB and C# can differ if they generate different MSIL (specifically for loops are very different in C# and VB, as VB caches the upper bound whereas C# keep on evaluating it for every iteration).

In my experience though switching languages is by far the worst thing you can do if you want to speed up some code. The first step should always be profiling. You need to find out what part of the code is slowest. It's very often not the part you might think, so don't rely on your intuition, profile the code. Then you need to optimize that part, this is the difficult part, and sometimes you're out of luck, but at least you can talk to people about how to optimize code once you've determined what code you want to optimize.

Thank you David for the richful answer.
I opened another thread, asking the way my code could be profiled.

I've looked for a very clever tool, line_profiler, to widely scout th script.
The problem is that Ghrasshopper Python doesn't allow me to import it, even id installed directely in the IronPython directory. How could I fix this?

Is there any other way to do it directely in grasshopper?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service