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.
29 lines
498 B
29 lines
498 B
/*
|
|
* Test JSON number parsing (decode loop) for arbitrary numbers.
|
|
*/
|
|
|
|
if (typeof print !== 'function') { print = console.log; }
|
|
|
|
function test() {
|
|
var arr = [];
|
|
var i;
|
|
|
|
for (i = 0; i < 1e4; i++) {
|
|
arr[i] = 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;
|
|
}
|
|
|