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.
 
 
 
 
 
 

29 lines
544 B

/*
* Test creation and interning of new strings when the intern check
* misses any existing strings in the string table. Exercises string
* hashing and memory churn.
*/
function test() {
var buf = Duktape.Buffer(2048);
var i;
for (i = 0; i < buf.length; i++) {
buf[i] = i;
}
for (i = 0; i < 1e6; i++) {
// make buffer value unique
buf[0] = i;
buf[1] = i >> 8;
buf[2] = i >> 16;
void String(buf);
}
}
try {
test();
} catch (e) {
print(e.stack || e);
}