The FastString class is stringbuilder implementation. It is used to append many short strings into one long string. The difference between the FastString class and using A = A & "Kalle" in VB is the speed. One application for it is in web-components that needs to generate HTML or XML as return values.
Here are some performance data:
Task |
VB [s] |
FastString [s] |
Appending a 10 character long string 10000 times |
0.5915 |
0.0196 |
Appending a 10 character long string 20000 times |
2.2230 |
0.0508 |
Appending a 10 character long string 30000 times |
9.9740 |
0.0801 |
Appending a 10 character long string 40000 times |
28.3509 |
0.0897 |
Appending a 10 character long string 50000 times |
52.4963 |
0.1292 |
Be the first to leve a comment or ask a question about the code!
The interface:
- append(Data as String)
Appends the string Data to the internal buffer.
- toString() as String
Returns the internal buffer as a string.
- toByte() as Byte()
Returns the internal buffer as a byte array.