Site
News
Files Visual Basic
Strings
Math
General
Properties
Memory
Methods Search
Testing Inline ASM-VB
Strings
Math
General
Memory Search
Using inline ASM
Submit!
News
Files Visual Basic
Strings
Math
General
Properties
Memory
Methods Search
Testing Inline ASM-VB
Strings
Math
General
Memory Search
Using inline ASM
Submit!
vbNewLine vs vbCrLfA bit erratic, but some decent performance gain here.
If I'm correct, vbNewLine and vbCrLf perform the same function. the vbNewLine constant seems to be faster though.
I'm not clearing the variables after each iteration..that's why you see an increase graphic, and time. Pretty interesting I have to admit. It's clear to see that adding a new line to a larger text takes more time
User contributed notes:
Code: |
Code: |
vbCrLF % faster than vbNewLine2 | vbCrLF (sec) | vbNewLine2 (sec) |
48.7% | 0.062234 | 0.041854 |
116% | 0.349525 | 0.161789 |
23.1% | 0.693035 | 0.562858 |
24.5% | 1.107912 | 0.889901 |
40.5% | 1.545385 | 1.099965 |
User contributed notes:
Author: PRoPHEZZoR (Name_Here_No_Spam at HaCKERMAiL dot COM) | Date: 11:08 24/08/2004 |
I think vbCrLf might not be a real constant, rather a concentration of vbCr & vbLf | |
Author: SuperDre () | Date: 11:03 08/03/2005 |
Have you thought about the possibility that vbNewLine could also be just only vbLf? as it is platform dependant.. and adding 1 character would take less ofcourse as adding 2 characters.. | |
Author: Comintern () | Date: 21:03 15/03/2005 |
They're the same: Debug.Print (Asc(Left(vbNewLine, 1)) & "," & Asc(Right(vbNewLine, 1))) Debug.Print (Asc(Left(vbCrLf, 1)) & "," & Asc(Right(vbCrLf, 1))) |
|
Author: Tom (hurendo_kun at hotmail dot com) | Date: 14:05 31/05/2005 |
Yes, for Windows XP they are identical, so there should be no difference in performance. | |
Author: CJ (xfakemail at hotmail dot com) | Date: 18:12 17/12/2005 |
Well well well.. I think since they do the same thing it would be better to use vbcrlf cus the string is shorter. don't u think? |
|
Author: Spodi () | Date: 23:02 10/02/2007 |
They're the same length and characters, CJ. I believe vbCrLf is made from vbCr + vbLf, while vbNewLine takes out the + and is a 2-character constant. |