19-03-2009, 06:34 PM
Ok, just did a test of String$() vs Space$().
Space$() wins.
10 loops of 50,000.
10 loops of 10,000.
Space$() wins.
10 loops of 50,000.
Code:
%Faster 69.2| 83.3| 76.9| 69.2| 69.2| 50| 69.2| 83.3| 64.3| 57.1
Test1 22| 22| 23| 22| 22| 21| 22| 22| 23| 22
Test2 13| 12| 13| 13| 13| 14| 13| 12| 14| 14
10 loops of 10,000.
Code:
%Faster 200| 200| 200| 200| 200| 200| 200| 200| 200| 200
Test1 3| 3| 3| 3| 3| 3| 3| 3| 3| 3
Test2 1| 1| 1| 1| 1| 1| 1| 1| 1| 1
Code:
Public Sub TestOne()
Dim s As String
s = String$(40, " ")
End Sub
Code:
Public Sub TestTwo()
Dim s As String
s = Space$(40)
End Sub