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.
 
 
 
 
 
 

27 lines
452 B

/*
* Test JSON number parsing (decode loop) for fast path integers.
*/
function test() {
var arr = [];
var i;
for (i = 0; i < 1e4; i++) {
arr[i] = Math.floor(Math.random() * 1e9);
}
var jsondata = JSON.stringify(arr);
print(jsondata.length);
//print(jsondata);
for (i = 0; i < 100; i++) {
void JSON.parse(jsondata);
}
}
try {
test();
} catch (e) {
print(e.stack || e);
throw e;
}