Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2004

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Philippe TEIRUH - 27 Sep 2004 17:45 GMT
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 expect change 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"
Mattias Sj?gren - 27 Sep 2004 22:21 GMT
Philippe,

>1. Is that fact well known?

Well all managed<->native transitions cause some overhead.

>2. How to solve the problem?

Keep the loop code in native code (VB6) and call it from VB.NET.

>3. Can we expect change in latter version?

I doubt it.

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.