I am currently converting an application that automated PC-DMIS in VB6 over to C#. Our application does the following:
1) Ask the user what PC-DMIS program (i.e. a PRG file) they want to run
2) Launch PC-DMIS passing in the name of the program file selected
3) Get PC-DMIS to run a series of measurements on a Scirocco machine
4) Import the measurements from PC-DMIS into the application for processing
5) Process the results (basically we compare the measurements to a baseline, then insert the deviation into a database)
What I observed is that for any program (we've tried quite a few and this seems to be consistently happening), the VB6 application takes approximately 30 seconds to perform step 4, whereas the C# application takes around 2.5 minutes.
Can anyone help with the following questions please?
1) We directly ported the code from the legacy VB6 application to C# so the new program isn't doing anything different from what the old VB6 one used to do, so why does C# take so much longer than VB6 to perform the import?
2) Is there any way to speed it up, e.g. I think I read something on a forum that VB.NET may be faster, but I can't find anything technical from Microsoft to support that so I can't really justify burning a lot of hours to convert from C# to VB.NET in case it is the same speed?
Sorry I abbreviated the file writing piece. Basically all we do inside the loop is add the data to a stringbuilder object, then after the loop finishes we write it to file in one action. The executedCommands and executedCommandsCount were just there as I was trying to see if there were less executed commands than PCPart.Commands.Count. The plan was to use PCPart.ExecutedCommands in the loop if it had fewer than PCPart.Commands. However it doesn't so I'll remove those from the code.
The apparent slowness of indexing into commands (i.e. var PCCommand = PCPart.Commands.Item(i)) sounds like it's worth exploring so I'll have a look at how we code that differently.
Many thanks again for the suggestions. I'll be sure to circle back with any updates from my side in due course (it may be a day or 2 as the Scirocco machines are down for an upgrade right now).
Sorry I abbreviated the file writing piece. Basically all we do inside the loop is add the data to a stringbuilder object, then after the loop finishes we write it to file in one action. The executedCommands and executedCommandsCount were just there as I was trying to see if there were less executed commands than PCPart.Commands.Count. The plan was to use PCPart.ExecutedCommands in the loop if it had fewer than PCPart.Commands. However it doesn't so I'll remove those from the code.
The apparent slowness of indexing into commands (i.e. var PCCommand = PCPart.Commands.Item(i)) sounds like it's worth exploring so I'll have a look at how we code that differently.
Many thanks again for the suggestions. I'll be sure to circle back with any updates from my side in due course (it may be a day or 2 as the Scirocco machines are down for an upgrade right now).