Speed : The PIA impact (VB 6.0 vs VB.NET)

G

Guest

Hello,

I have made a migration from VB 6.0 to VB.NET and noticed a great speed
change when I access (from VB) to Excel Cells (same problem to write Visio
formulas from VB).
The same code takes 21 seconds in VB 6.0 and 54 seconds in VB.NET (see below)

1. Is that fact well known?
2. How to solve the problem?
3. Can we hope amelioration in latter version?

---------------------------------------------------------

In VB 6.0 the following code is executed in 21 seconds in VB 6.0 and 54
seconds in VB.NET on the same PC:


Dim I As Integer
Dim J As Integer
Dim myExcelApp As Excel.Application
Dim objBook As Excel.Workbook
Dim objSheet As Excel.Worksheet
Dim dStart As Double

Set myExcelApp = CreateObject("Excel.Application")
Set objBook = myExcelApp.Workbooks.Add("D:\toto.xls")
Set objSheet = objBook.Worksheets("Sheet1")

dStart = Timer

For I = 1 To 60
For J = 1 To 100
objSheet.Cells(J, I).Value = 1
Next J
Next I
MsgBox ("This operation took : " & CStr(CInt(Timer - dStart)) & "
seconds")

--------------------------------------------------------------------------------------

Thank you

Philippe

PS : To make yourself the experience on VB.NET, just replace in this VB 6.0
code "Timer" by "Microsoft.VisualBasic.Timer"
 
J

Jon Skeet [C# MVP]

Philippe TEIRUH said:
I have made a migration from VB 6.0 to VB.NET and noticed a great speed
change when I access (from VB) to Excel Cells (same problem to write Visio
formulas from VB).
The same code takes 21 seconds in VB 6.0 and 54 seconds in VB.NET (see below)

1. Is that fact well known?
2. How to solve the problem?
3. Can we hope amelioration in latter version?

Is this using Option Strict On or not? I believe interop is much slower
using Option Strict Off than On.

You will probably find that others in the VB.NET group
(microsoft.public.dotnet.languages.vb) or in the interop group
(microsoft.public.dotnet.framework.interop) can give you more
information on that.
 
C

Cor Ligthert

Philippe,

Did you try that in a loop or only one time, dotNet programs can be slower
the first time that the code is used. Which is a general fact for all dotNet
programs what has to do with the JIT compiling.

When that is not the problem there is for VB6 upgrade is a special newsgroup

Microsoft.public.dotnet.languages.vb.upgrade

I hope this helps?

Cor
 
G

Guest

Thank you for the ideas

I will try on
microsoft.public.dotnet.framework.interop
Microsoft.public.dotnet.languages.vb.upgrade
microsoft.public.dotnet.languages.vb

Philippe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top