mirror of https://github.com/svaarala/duktape.git
Sami Vaarala
3 years ago
21 changed files with 686 additions and 11 deletions
@ -0,0 +1,35 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 1024; i++) { |
|||
str.push(i & 0x7f); |
|||
} |
|||
str = String.fromCharCode.apply(null, str); |
|||
print(str.length); |
|||
|
|||
var suffix1 = str.substr(str.length - 10, str.length); |
|||
var suffix2 = '_' + suffix1; // No match.
|
|||
|
|||
for (i = 0; i < 1e6; i++) { |
|||
void str.endsWith(suffix1); |
|||
void str.endsWith(suffix2); |
|||
void str.endsWith(suffix1); |
|||
void str.endsWith(suffix2); |
|||
void str.endsWith(suffix1); |
|||
void str.endsWith(suffix2); |
|||
void str.endsWith(suffix1); |
|||
void str.endsWith(suffix2); |
|||
void str.endsWith(suffix1); |
|||
void str.endsWith(suffix2); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,35 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 1024; i++) { |
|||
str.push(i & 0xffff); |
|||
} |
|||
str = String.fromCharCode.apply(null, str); |
|||
print(str.length); |
|||
|
|||
var suffix1 = str.substr(str.length - 10, str.length); |
|||
var suffix2 = '_' + suffix1; // No match.
|
|||
|
|||
for (i = 0; i < 1e6; i++) { |
|||
void str.endsWith(suffix1); |
|||
void str.endsWith(suffix2); |
|||
void str.endsWith(suffix1); |
|||
void str.endsWith(suffix2); |
|||
void str.endsWith(suffix1); |
|||
void str.endsWith(suffix2); |
|||
void str.endsWith(suffix1); |
|||
void str.endsWith(suffix2); |
|||
void str.endsWith(suffix1); |
|||
void str.endsWith(suffix2); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,29 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var i; |
|||
var x; |
|||
|
|||
x = 'foobar\u{1f4a9}'.repeat(1000); |
|||
console.log(x); |
|||
|
|||
for (i = 0; i < 1e5; i++) { |
|||
void x.indexOf('\u{1f4a9}'); |
|||
void x.indexOf('\u{1f4a9}', 3000); |
|||
void x.indexOf('\u{1f4a9}'); |
|||
void x.indexOf('\u{1f4a9}', 3000); |
|||
void x.indexOf('\u{1f4a9}'); |
|||
void x.indexOf('\u{1f4a9}', 3000); |
|||
void x.indexOf('\u{1f4a9}'); |
|||
void x.indexOf('\u{1f4a9}', 3000); |
|||
void x.indexOf('\u{1f4a9}'); |
|||
void x.indexOf('\u{1f4a9}', 3000); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,29 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var i; |
|||
var x; |
|||
|
|||
x = 'foobar\u{1f4a9}'.repeat(1000); |
|||
console.log(x); |
|||
|
|||
for (i = 0; i < 1e5; i++) { |
|||
void x.lastIndexOf('\u{1f4a9}'); |
|||
void x.lastIndexOf('\u{1f4a9}', 3000); |
|||
void x.lastIndexOf('\u{1f4a9}'); |
|||
void x.lastIndexOf('\u{1f4a9}', 3000); |
|||
void x.lastIndexOf('\u{1f4a9}'); |
|||
void x.lastIndexOf('\u{1f4a9}', 3000); |
|||
void x.lastIndexOf('\u{1f4a9}'); |
|||
void x.lastIndexOf('\u{1f4a9}', 3000); |
|||
void x.lastIndexOf('\u{1f4a9}'); |
|||
void x.lastIndexOf('\u{1f4a9}', 3000); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,42 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 65536; i++) { |
|||
str.push(i & 0xffff); |
|||
} |
|||
str = String.fromCharCode.apply(null, str).repeat(64); |
|||
print(str.length); |
|||
|
|||
/* Because this testcase is not about interning, intern the substrings |
|||
* to avoid string table traffic in this particular test. |
|||
*/ |
|||
var dummy = []; |
|||
while (dummy.length < 0x10000) { |
|||
dummy.push(String.fromCharCode(dummy.length)); |
|||
} |
|||
print(dummy.length); |
|||
|
|||
var strlen = str.length; |
|||
for (i = 0; i < 250; i++) { |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,42 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 1024; i++) { |
|||
str.push(i & 0xffff); |
|||
} |
|||
str = String.fromCharCode.apply(null, str); |
|||
print(str.length); |
|||
|
|||
/* Because this testcase is not about interning, intern the substrings |
|||
* to avoid string table traffic in this particular test. |
|||
*/ |
|||
var dummy = []; |
|||
while (dummy.length < 0x10000) { |
|||
dummy.push(String.fromCharCode(dummy.length)); |
|||
} |
|||
print(dummy.length); |
|||
|
|||
var strlen = str.length; |
|||
for (i = 0; i < 1e6; i++) { |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
void str.charCodeAt(Math.random() * strlen); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,29 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var i; |
|||
var x; |
|||
|
|||
x = 'foobarX'.repeat(1000); |
|||
console.log(x); |
|||
|
|||
for (i = 0; i < 1e5; i++) { |
|||
void x.replace('X', 'ZZ'); |
|||
void x.replace('X', 'ZZ'); |
|||
void x.replace('X', 'ZZ'); |
|||
void x.replace('X', 'ZZ'); |
|||
void x.replace('X', 'ZZ'); |
|||
void x.replace('X', 'ZZ'); |
|||
void x.replace('X', 'ZZ'); |
|||
void x.replace('X', 'ZZ'); |
|||
void x.replace('X', 'ZZ'); |
|||
void x.replace('X', 'ZZ'); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,29 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var i; |
|||
var x; |
|||
|
|||
x = 'foobarX'.repeat(1000); |
|||
console.log(x); |
|||
|
|||
for (i = 0; i < 5e2; i++) { |
|||
void x.replace(/X/g, 'ZZ'); |
|||
void x.replace(/X/g, 'ZZ'); |
|||
void x.replace(/X/g, 'ZZ'); |
|||
void x.replace(/X/g, 'ZZ'); |
|||
void x.replace(/X/g, 'ZZ'); |
|||
void x.replace(/X/g, 'ZZ'); |
|||
void x.replace(/X/g, 'ZZ'); |
|||
void x.replace(/X/g, 'ZZ'); |
|||
void x.replace(/X/g, 'ZZ'); |
|||
void x.replace(/X/g, 'ZZ'); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,29 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var i; |
|||
var x; |
|||
|
|||
x = 'foobar\u{1f4a9}'.repeat(1000); |
|||
console.log(x); |
|||
|
|||
for (i = 0; i < 1e5; i++) { |
|||
void x.replace('\ud83d', 'XX'); |
|||
void x.replace('\ud83d', 'XX'); |
|||
void x.replace('\ud83d', 'XX'); |
|||
void x.replace('\ud83d', 'XX'); |
|||
void x.replace('\ud83d', 'XX'); |
|||
void x.replace('\ud83d', 'XX'); |
|||
void x.replace('\ud83d', 'XX'); |
|||
void x.replace('\ud83d', 'XX'); |
|||
void x.replace('\ud83d', 'XX'); |
|||
void x.replace('\ud83d', 'XX'); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,29 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var i; |
|||
var x; |
|||
|
|||
x = 'foobar\u{1f4a9}'.repeat(1000); |
|||
console.log(x); |
|||
|
|||
for (i = 0; i < 5e2; i++) { |
|||
void x.replace(/\ud83d/g, 'XX'); |
|||
void x.replace(/\ud83d/g, 'XX'); |
|||
void x.replace(/\ud83d/g, 'XX'); |
|||
void x.replace(/\ud83d/g, 'XX'); |
|||
void x.replace(/\ud83d/g, 'XX'); |
|||
void x.replace(/\ud83d/g, 'XX'); |
|||
void x.replace(/\ud83d/g, 'XX'); |
|||
void x.replace(/\ud83d/g, 'XX'); |
|||
void x.replace(/\ud83d/g, 'XX'); |
|||
void x.replace(/\ud83d/g, 'XX'); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,50 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 65536; i++) { |
|||
str.push(i & 0xffff); |
|||
} |
|||
str = String.fromCharCode.apply(null, str).repeat(64); |
|||
print(str.length); |
|||
|
|||
/* Because this testcase is not about interning, intern the substrings |
|||
* to avoid string table traffic in this particular test. |
|||
*/ |
|||
var dummy = [ |
|||
str.charAt(0), |
|||
str.charAt(2023000), |
|||
str.charAt(100000), |
|||
str.charAt(200000), |
|||
str.charAt(300000), |
|||
str.charAt(400000), |
|||
str.charAt(900000), |
|||
str.charAt(800000), |
|||
str.charAt(700000), |
|||
str.charAt(600000), |
|||
str.charAt(500000) |
|||
]; |
|||
|
|||
for (i = 0; i < 500; i++) { |
|||
void str.charCodeAt(0); |
|||
void str.charCodeAt(2023000); |
|||
void str.charCodeAt(100000); |
|||
void str.charCodeAt(200000); |
|||
void str.charCodeAt(300000); |
|||
void str.charCodeAt(400000); |
|||
void str.charCodeAt(900000); |
|||
void str.charCodeAt(800000); |
|||
void str.charCodeAt(700000); |
|||
void str.charCodeAt(600000); |
|||
void str.charCodeAt(500000); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,29 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var i; |
|||
var x; |
|||
|
|||
x = 'foobar\u{1f4a9}'.repeat(1000); |
|||
console.log(x); |
|||
|
|||
for (i = 0; i < 1e4; i++) { |
|||
void x.split('\u{1f4a9}'); |
|||
void x.split('\u{1f4a9}'); |
|||
void x.split('\u{1f4a9}'); |
|||
void x.split('\u{1f4a9}'); |
|||
void x.split('\u{1f4a9}'); |
|||
void x.split('\u{1f4a9}'); |
|||
void x.split('\u{1f4a9}'); |
|||
void x.split('\u{1f4a9}'); |
|||
void x.split('\u{1f4a9}'); |
|||
void x.split('\u{1f4a9}'); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,35 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 1024; i++) { |
|||
str.push(i & 0x7f); |
|||
} |
|||
str = String.fromCharCode.apply(null, str); |
|||
print(str.length); |
|||
|
|||
var prefix1 = str.substr(0, 10); |
|||
var prefix2 = prefix1 + '_'; // No match.
|
|||
|
|||
for (i = 0; i < 1e6; i++) { |
|||
void str.startsWith(prefix1); |
|||
void str.startsWith(prefix2); |
|||
void str.startsWith(prefix1); |
|||
void str.startsWith(prefix2); |
|||
void str.startsWith(prefix1); |
|||
void str.startsWith(prefix2); |
|||
void str.startsWith(prefix1); |
|||
void str.startsWith(prefix2); |
|||
void str.startsWith(prefix1); |
|||
void str.startsWith(prefix2); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,35 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 1024; i++) { |
|||
str.push(i & 0xffff); |
|||
} |
|||
str = String.fromCharCode.apply(null, str); |
|||
print(str.length); |
|||
|
|||
var prefix1 = str.substr(0, 10); |
|||
var prefix2 = prefix1 + '_'; // No match.
|
|||
|
|||
for (i = 0; i < 1e6; i++) { |
|||
void str.startsWith(prefix1); |
|||
void str.startsWith(prefix2); |
|||
void str.startsWith(prefix1); |
|||
void str.startsWith(prefix2); |
|||
void str.startsWith(prefix1); |
|||
void str.startsWith(prefix2); |
|||
void str.startsWith(prefix1); |
|||
void str.startsWith(prefix2); |
|||
void str.startsWith(prefix1); |
|||
void str.startsWith(prefix2); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,33 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 1024; i++) { |
|||
str.push(i & 0x7f); |
|||
} |
|||
str = String.fromCharCode.apply(null, str); |
|||
print(str.length); |
|||
|
|||
var strlen = str.length; |
|||
for (i = 0; i < 1e5; i++) { |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,33 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 65536; i++) { |
|||
str.push(i & 0x7f); |
|||
} |
|||
str = String.fromCharCode.apply(null, str); |
|||
print(str.length); |
|||
|
|||
var strlen = str.length; |
|||
for (i = 0; i < 5e4; i++) { |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,33 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 65536; i++) { |
|||
str.push(i & 0x7f); |
|||
} |
|||
str = String.fromCharCode.apply(null, str).repeat(16); // 1M codepoints
|
|||
print(str.length); |
|||
|
|||
var strlen = str.length; |
|||
for (i = 0; i < 1e4; i++) { |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,33 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 1024; i++) { |
|||
str.push(i); |
|||
} |
|||
str = String.fromCharCode.apply(null, str); |
|||
print(str.length); |
|||
|
|||
var strlen = str.length; |
|||
for (i = 0; i < 1e5; i++) { |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,33 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 65536; i++) { |
|||
str.push(i); |
|||
} |
|||
str = String.fromCharCode.apply(null, str); |
|||
print(str.length); |
|||
|
|||
var strlen = str.length; |
|||
for (i = 0; i < 2e3; i++) { |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
@ -0,0 +1,33 @@ |
|||
if (typeof print !== 'function') { print = console.log; } |
|||
|
|||
function test() { |
|||
var str = []; |
|||
var i; |
|||
|
|||
for (i = 0; i < 65536; i++) { |
|||
str.push(i); |
|||
} |
|||
str = String.fromCharCode.apply(null, str).repeat(16); // 1M codepoints
|
|||
print(str.length); |
|||
|
|||
var strlen = str.length; |
|||
for (i = 0; i < 2e2; i++) { |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
void str.substring(Math.random() * strlen, Math.random() * strlen); |
|||
} |
|||
} |
|||
|
|||
try { |
|||
test(); |
|||
} catch (e) { |
|||
print(e.stack || e); |
|||
throw e; |
|||
} |
Loading…
Reference in new issue