G
Guest
I migrated VB6 code to VB.Net and after building in the release mode and setting Optimizations to Remove integer overflow checks and Enable optimizations the exe runs at a miserably slow speed compared to VB6 exe.
Processing an 80k byte text file in VB6 takes less then a second.
The same code processs in VB.Net takes over a minute.
What am I overlooking?
The code is converting Un-typeable characters into typeable characters. It is called "Stretch" and increases the length of the file a bit . It is from an old Visual Basic book by John Craig.
I migrated it almost as is to VB.Net
Here is the code:
lA = (Len(msText))
sB = Space(lA + (lA + 2) \ 3) 'New Stretched length
For lI = 1 To lA
nC = (Asc(Mid(msText, lI, 1)))
lJ = lJ + 1
Mid(sB, lJ, 1) = Chr((nC And 63) + 59)
Select Case lI Mod 3
Case 1
nK = (nK Or ((nC \ 64) * 16))
Case 2
nK = (nK Or ((nC \ 64) * 4))
Case 0
nK = (nK Or (nC \ 64))
lJ = lJ + 1
Mid(sB, lJ, 1) = Chr(nK + 59)
nK = 0
End Select
Next lI
Processing an 80k byte text file in VB6 takes less then a second.
The same code processs in VB.Net takes over a minute.
What am I overlooking?
The code is converting Un-typeable characters into typeable characters. It is called "Stretch" and increases the length of the file a bit . It is from an old Visual Basic book by John Craig.
I migrated it almost as is to VB.Net
Here is the code:
lA = (Len(msText))
sB = Space(lA + (lA + 2) \ 3) 'New Stretched length
For lI = 1 To lA
nC = (Asc(Mid(msText, lI, 1)))
lJ = lJ + 1
Mid(sB, lJ, 1) = Chr((nC And 63) + 59)
Select Case lI Mod 3
Case 1
nK = (nK Or ((nC \ 64) * 16))
Case 2
nK = (nK Or ((nC \ 64) * 4))
Case 0
nK = (nK Or (nC \ 64))
lJ = lJ + 1
Mid(sB, lJ, 1) = Chr(nK + 59)
nK = 0
End Select
Next lI