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
512 B

/*
* Test JSON number parsing (decode loop) for fast path integers.
*/
if (typeof print !== 'function') { print = console.log; }
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 < 1000; i++) {
void JSON.parse(jsondata);
}
}
try {
test();
} catch (e) {
print(e.stack || e);
throw e;
}