AnsweredAssumed Answered

VBA vs VB.NET Performance

Question asked by Checkcheck Master on Jan 25, 2016
Latest reply on Jan 26, 2016 by Checkcheck Master

Hi there,

 

I put my First steps into VB.NET ‘comming from VBA’.

In my macro one of the modules iterates trough all the dimension names in a part or assembly and search for a particular name and further on an combination of them to create a Configuration Specific Custom Property ‘Size’.

Surprisingly in VB.NET it takes much longer, approx. 2.5 seconds in total, to iterate trough the dimension names as in VBA, approx a couple of milliseconds/’just a blink’.

I simply copy and paste the VBA code into VB.NET and make the necessary changes to get it work so the used technique is the same.

In VBA I use late binding to avoid possible errors regarding the VBA editor(the reason why I switch to VB.NET), I also tried Early binding but regarding performance I found no noticeable difference between them.

In VB.NET I use early binding which is, I found on the internet, preferred in relation to performance etc.

I already turned on and off the ‘debug.print’ lines to see the changes with or without.

For me now it looks like ‘VBA is winning the race’ regarding this subject compared to VB.NET while I thought VB.NET’s performance would be better.

Since I prefer to run this module for every Part or Assembly to end up with an accurate Size value it is preferred to do this step as fast as possible, 2.5 seconds can be annoying every time a file is saved. 

 

How should I look to this ?

Am I doing something wrong or… ?

 

Greetings!

Outcomes