mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
414 B
24 lines
414 B
10 years ago
|
/*
|
||
|
* Build string with plain concat. Causes O(n^2) behavior in Duktape
|
||
|
* string implementation because every intermediate step is string interned.
|
||
|
*/
|
||
|
|
||
|
function test() {
|
||
|
var i, j;
|
||
|
var t;
|
||
|
|
||
|
for (i = 0; i < 1; i++) {
|
||
|
t = '';
|
||
|
for (j = 0; j < 1e5; j++) {
|
||
|
t += 'x';
|
||
|
//print(t.length);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
test();
|
||
|
} catch (e) {
|
||
|
print(e.stack || e);
|
||
|
}
|