Control:
| Bytes | Appends | Elapsed Milliseconds |
|---|---|---|
| 1000 | 10000 | 2898 |
| 1000 | 10000 | 2898 |
| 1000 | 10000 | 2899 |
Converting the Uint8Array to a "binary string" with String.fromCharCode and then using btoa:
| Bytes | Appends | Elapsed Milliseconds |
|---|---|---|
| 1000 | 10000 | 3458 |
| 1000 | 10000 | 3415 |
| 1000 | 10000 | 3423 |
Turning the Uint8Array into a regular array with slice, mapping the result with String.fromCharCode, and then joining with the empty string:
| Bytes | Appends | Elapsed Milliseconds |
|---|---|---|
| 1000 | 10000 | 5955 |
| 1000 | 10000 | 6202 |
| 1000 | 10000 | 5681 |
Creating a blob and using FileReader's readAsDataURL to base64 encode it:
| Bytes | Appends | Elapsed Milliseconds |
|---|---|---|
| 1000 | 10000 | 4379 |
| 1000 | 10000 | 4585 |
| 1000 | 10000 | 4649 |
| 1000 | 10000 | 4534 |
| 1000 | 10000 | 4722 |
Performing an "interesting" byte-by-byte transformation in a single pass. This isn't actual base64 encoding but it should be roughly equivalent:
| Bytes | Appends | Elapsed Milliseconds |
|---|---|---|
| 1000 | 10000 | 2298 |
| 1000 | 10000 | 2240 |
| 1000 | 10000 | 2303 |
Pass a constant, 1000 length string of As into the SWF:
| Bytes | Appends | Elapsed Milliseconds |
|---|---|---|
| 1000 | 10000 | 2339 |
| 1000 | 10000 | 2375 |
| 1000 | 10000 | 2380 |
| 1000 | 10000 | 2582 |
| 1000 | 10000 | 2487 |
Varying number of appends:
| Bytes | Appends | Elapsed Milliseconds |
|---|---|---|
| 1000 | 10000 | 2543 |
| 1000 | 10000 | 2546 |
| 1000 | 10000 | 2624 |
| 10000 | 1000 | 623 |
| 10000 | 1000 | 609 |
| 10000 | 1000 | 623 |