| 1 |
#include <tads.h> |
| 2 |
|
| 3 |
main(args) |
| 4 |
{ |
| 5 |
if (args.length < 2) |
| 6 |
{ |
| 7 |
"usage: test <n>, where n is the number of list elements |
| 8 |
to build\n"; |
| 9 |
return; |
| 10 |
} |
| 11 |
local limit = toInteger(args[2]); |
| 12 |
local tot = 0; |
| 13 |
for (local i = 1 ; i < limit ; ++i) |
| 14 |
tot += stringOf(i).length(); |
| 15 |
"Number of elements: <<limit>> |
| 16 |
\nTotal combined string length: <<tot>> |
| 17 |
\nTotal with TADS 2 list overhead: <<tot + 3*limit + 2>>\n"; |
| 18 |
} |
| 19 |
|
| 20 |
stringOf(i) |
| 21 |
{ |
| 22 |
local rv = ''; |
| 23 |
while (--i > 0) |
| 24 |
rv += toString(i); |
| 25 |
return rv; |
| 26 |
} |