Grasshopper

algorithmic modeling for Rhino

Hi everyone,

The more code my VB component has the longer it takes to open it.

My script is now so big it takes 45 seconds (!) to open.

It is getting difficult to work because I need to execute the script about every minute to view results.

Is this normal?

Thanks!
Fernando

Views: 891

Replies to This Discussion

Hi Fernando, I never use very large scripts in components as I find it cumbersome to write them. I typically switch to Visual Studio when having to write lots of code.

It shouldn't take a long time to open large scripts though. The first time you open the script editor it will probably take a few seconds as the code editor needs to be JIT-compiled, but after that it should be fast. If it isn't, it may well be my fault.

Can you upload (or email) a file with such an annoying script? I can see whether it takes a long time on the internal build as well and I might be able to find the bottleneck.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hi David,

Thank you for the feedback.

I've tested it some more, and the actual script doesn't really matter. As soon as it becomes longer (>1000 lines), opening the VB component takes a long time.

I've attached an example script that has the same length as my actual script.

My actual script cannot be recreated with components due to all the math that is going on.

Remarkable is that the script is executed very fast, only opening the editor takes long.

Hope you have an idea how to fix it.

Thanks!

Attachments:

Yep, that takes a good 11 to 12 seconds on my laptop. I'll start profiling it whenever I have some time (I'm actually on the road now). I'll get back to you if I manage to find/fix the problem.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks!

FWIW I've also noticed laggy script editor component behavior with the C# script editor as well. 

Probably, they are practically the same code. It's just that one of them loads the C# syntax parser and the other the VB syntax parser.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

David! Same happens for Python component too.

I tracked down the bottleneck and the file you posted now takes 0.02 seconds to load the code instead of 13.68

--

David Rutten

david@mcneel.com

Poprad, Slovakia

That is great, when can we expect an updated version?

Thanks!

I'm plowing towards the new release as quickly as I can (house-hunting in the meantime is delaying the release a bit). I dare not give an actual date though.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

While we're on the subject: maybe it would be possible to create an extra button in the VB scripting environment that executes the script without closing it?

I'm asking because another time consuming part of working with the VB component is looking up where I was working. And since that is mostly further down the script (line >1000) it always takes time to find it.

Well, maybe you can help on that point too.

Okay, looking forward to the update, thank you for your great work!

How about trying to re-instate the last view in the code editor? It would still require you to close the editor to run the script, but at least you'd always start where you left off.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service