D
Dominique Vandensteen
after the very small & vs string.format discussion I did some speed tests...
loop of 1.000.000 concatenations of 5 public string variables in a class
gave following results:
result = a & b & c & d & e
+/- 420ms
result = a
result &= b
result &= c
result &= d
result &= e
+/- 370ms
dim result as new StringBuilder()
result.Append(a)
result.Append(b)
result.Append(c)
result.Append(d)
result.Append(e)
new StringBuilder in each loop: +/- 730ms
new StringBuilder outside + result.length=0 in each loop: +/- 690ms
result = String.Format("{0}{1}{2}{3}{4}", a, b, c, d, e)
+/- 1540ms
so in my opinion, only use string.format to do real formatting
the difference between the first 2 seems strange to me
is this a compiler problem?
oh yes, everything was ran in debug mode in visual studio 2003...
dominique
loop of 1.000.000 concatenations of 5 public string variables in a class
gave following results:
result = a & b & c & d & e
+/- 420ms
result = a
result &= b
result &= c
result &= d
result &= e
+/- 370ms
dim result as new StringBuilder()
result.Append(a)
result.Append(b)
result.Append(c)
result.Append(d)
result.Append(e)
new StringBuilder in each loop: +/- 730ms
new StringBuilder outside + result.length=0 in each loop: +/- 690ms
result = String.Format("{0}{1}{2}{3}{4}", a, b, c, d, e)
+/- 1540ms
so in my opinion, only use string.format to do real formatting
the difference between the first 2 seems strange to me
is this a compiler problem?
oh yes, everything was ran in debug mode in visual studio 2003...
dominique