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?
Thanks for the replies so far. I agree with ewe0006 that, as per what Microsoft says, all .NET languages are equal, i.e. one can't do more or be faster than another.
So I guess that really just leaves the code side of things...
This is an excerpt from the VB6 code at the point where it versus C# is so much quicker:
Set PcCmds = PcPart.Commands
For Each PcCmd In PcCmds
If PcCmd.IsTraceField Then
traceName = PcCmd.GetText(TRACE_NAME, 0)
Select Case traceName
Case "Die Number" 'All
dieNumber = PcCmd.GetText(TRACE_VALUE, 0)
Case "Part Number" 'All
partNumber = PcCmd.GetText(TRACE_VALUE, 0)
Case "Cast Date" 'All
castDate = PcCmd.GetText(TRACE_VALUE, 0)
Other case statements...
End Select
End If
Next PcCmd
For Each PcCmd In PcCmds
If PcCmd.IsDimension Then
If there's anything in the above folks can see where we're functionally different in C#, please shout. NOTE: the VB6 code above may be a horribly inefficient way to bring the information back from PC-DMIS so if there's a better way, I'd be glad to hear about it as all I'm confident to do is port the existing code over rather than rewriting it from scratch. All we're basically trying to do is automate the creation of a text file with dimensional and some other information. If there's an article of some other help documentation where there's an example, I'd appreciate if you would post a link as I can't find anything myself.
Thanks for the replies so far. I agree with ewe0006 that, as per what Microsoft says, all .NET languages are equal, i.e. one can't do more or be faster than another.
So I guess that really just leaves the code side of things...
This is an excerpt from the VB6 code at the point where it versus C# is so much quicker:
Set PcCmds = PcPart.Commands
For Each PcCmd In PcCmds
If PcCmd.IsTraceField Then
traceName = PcCmd.GetText(TRACE_NAME, 0)
Select Case traceName
Case "Die Number" 'All
dieNumber = PcCmd.GetText(TRACE_VALUE, 0)
Case "Part Number" 'All
partNumber = PcCmd.GetText(TRACE_VALUE, 0)
Case "Cast Date" 'All
castDate = PcCmd.GetText(TRACE_VALUE, 0)
Other case statements...
End Select
End If
Next PcCmd
For Each PcCmd In PcCmds
If PcCmd.IsDimension Then
If there's anything in the above folks can see where we're functionally different in C#, please shout. NOTE: the VB6 code above may be a horribly inefficient way to bring the information back from PC-DMIS so if there's a better way, I'd be glad to hear about it as all I'm confident to do is port the existing code over rather than rewriting it from scratch. All we're basically trying to do is automate the creation of a text file with dimensional and some other information. If there's an article of some other help documentation where there's an example, I'd appreciate if you would post a link as I can't find anything myself.