The following implementations were tested
| Name | Implementation Notes |
|---|---|
| StringChunker | String base, with in place modification |
| StringBuffer | String base, with in place modification, managed through a buffer |
| clsStringBuilder | Byte array base |
| StringBuilder | String base, with in place modification, managed through a buffer |
All times are in miliseconds and represent the average of 30 repetitions.
The first append test involved appending a single character to the end of the string using the library's append or concatenation function.
| Iterations | Default | clsStringBuilder | StringChunker | StringBuffer | StringBuilder |
|---|---|---|---|---|---|
| 102 | 0 | 1 | 0 | 0 | 0 |
| 103 | 2 | 1 | 1 | 0 | 1 |
| 104 | 170 | 8 | 6 | 2 | 3 |
| 105 | N/A | 103 | 58 | 23 | 30 |
| 106 | N/A | 747 | 525 | 155 | 320 |
An additional test was performed to better simulate real word use by appending a word of random letters between 1 and 10 characters.
| Iterations | Default | clsStringBuilder | StringChunker | StringBuffer | StringBuilder |
|---|---|---|---|---|---|
| 102 | 0 | 1 | 1 | 1 | 1 |
| 103 | 3 | 4 | 3 | 3 | 3 |
| 104 | 81 | 32 | 25 | 21 | 22 |
| 105 | 31259 | 322 | 249 | 216 | 241 |
| 106 | N/A | 3345 | 2551 | 2222 | 2386 |
For more information on why the performance of the StringBuilder classes far outperform regular concatenation, refer to the following articles on the Desktop Liberation blog here and here.