From b41371be9431ed29eefc6ac289d6357c9715804f Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Mon, 28 Sep 2015 00:38:57 +0300 Subject: [PATCH] Unroll perf test loops to reduce loop overhead With less loop overhead the micro benchmarks provide clearer results on how the actual operation being tested behaves. --- tests/perf/test-array-read.js | 11 ++++- tests/perf/test-array-read.lua | 14 +++++- tests/perf/test-array-read.pl | 11 ++++- tests/perf/test-array-read.py | 11 ++++- tests/perf/test-array-read.rb | 11 ++++- tests/perf/test-array-write.js | 11 ++++- tests/perf/test-array-write.lua | 11 ++++- tests/perf/test-array-write.pl | 11 ++++- tests/perf/test-array-write.py | 11 ++++- tests/perf/test-array-write.rb | 11 ++++- tests/perf/test-break-fast.js | 29 +++++++++++- tests/perf/test-break-slow.js | 56 +++++++++++++++++++++++- tests/perf/test-buffer-nodejs-read.js | 11 ++++- tests/perf/test-buffer-nodejs-write.js | 11 ++++- tests/perf/test-buffer-object-read.js | 11 ++++- tests/perf/test-buffer-object-write.js | 11 ++++- tests/perf/test-buffer-plain-read.js | 11 ++++- tests/perf/test-buffer-plain-write.js | 11 ++++- tests/perf/test-call-basic.js | 11 ++++- tests/perf/test-call-basic.lua | 11 ++++- tests/perf/test-call-basic.pl | 11 ++++- tests/perf/test-call-basic.py | 11 ++++- tests/perf/test-call-basic.rb | 11 ++++- tests/perf/test-call-native.js | 11 ++++- tests/perf/test-compile-mandel-nofrac.js | 11 ++++- tests/perf/test-compile-mandel.js | 11 ++++- tests/perf/test-compile-short.js | 11 ++++- tests/perf/test-continue-fast.js | 29 +++++++++++- tests/perf/test-continue-slow.js | 56 +++++++++++++++++++++++- tests/perf/test-prop-read.js | 11 ++++- tests/perf/test-prop-read.lua | 14 +++++- tests/perf/test-prop-read.pl | 11 ++++- tests/perf/test-prop-read.py | 11 ++++- tests/perf/test-prop-read.rb | 11 ++++- tests/perf/test-prop-write.js | 11 ++++- tests/perf/test-prop-write.lua | 11 ++++- tests/perf/test-prop-write.pl | 11 ++++- tests/perf/test-prop-write.py | 11 ++++- tests/perf/test-prop-write.rb | 11 ++++- tests/perf/test-regexp-string-parse.js | 11 ++++- tests/perf/test-regexp-string-parse.py | 11 ++++- 41 files changed, 540 insertions(+), 43 deletions(-) diff --git a/tests/perf/test-array-read.js b/tests/perf/test-array-read.js index 690c168e..b9bf6dec 100644 --- a/tests/perf/test-array-read.js +++ b/tests/perf/test-array-read.js @@ -7,7 +7,16 @@ function test() { var i; var ign; - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + ign = arr[7]; + ign = arr[7]; + ign = arr[7]; + ign = arr[7]; + ign = arr[7]; + ign = arr[7]; + ign = arr[7]; + ign = arr[7]; + ign = arr[7]; ign = arr[7]; } } diff --git a/tests/perf/test-array-read.lua b/tests/perf/test-array-read.lua index 95ad58a7..f5ec5697 100644 --- a/tests/perf/test-array-read.lua +++ b/tests/perf/test-array-read.lua @@ -1,7 +1,17 @@ function test() local arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } - for i=1,1e8 do - local ign = arr[8] + local ign + for i=1,1e7 do + ign = arr[8] + ign = arr[8] + ign = arr[8] + ign = arr[8] + ign = arr[8] + ign = arr[8] + ign = arr[8] + ign = arr[8] + ign = arr[8] + ign = arr[8] end end diff --git a/tests/perf/test-array-read.pl b/tests/perf/test-array-read.pl index fc89ba73..13325581 100644 --- a/tests/perf/test-array-read.pl +++ b/tests/perf/test-array-read.pl @@ -3,7 +3,16 @@ sub test { my $i; my $ign; - for ($i = 0; $i < 1e8; $i++) { + for ($i = 0; $i < 1e7; $i++) { + $ign = $arr[7]; + $ign = $arr[7]; + $ign = $arr[7]; + $ign = $arr[7]; + $ign = $arr[7]; + $ign = $arr[7]; + $ign = $arr[7]; + $ign = $arr[7]; + $ign = $arr[7]; $ign = $arr[7]; } } diff --git a/tests/perf/test-array-read.py b/tests/perf/test-array-read.py index 7a7c9fff..6b2e098f 100644 --- a/tests/perf/test-array-read.py +++ b/tests/perf/test-array-read.py @@ -1,7 +1,16 @@ def test(): arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; i = 0 - while i < 1e8: + while i < 1e7: + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] ign = arr[7] i += 1 diff --git a/tests/perf/test-array-read.rb b/tests/perf/test-array-read.rb index 9116097a..6f70206d 100644 --- a/tests/perf/test-array-read.rb +++ b/tests/perf/test-array-read.rb @@ -1,7 +1,16 @@ def test() arr = Array[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] i = 0 - while i < 1e8 do + while i < 1e7 do + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] + ign = arr[7] ign = arr[7] i += 1 end diff --git a/tests/perf/test-array-write.js b/tests/perf/test-array-write.js index 51c9e6a2..c3338840 100644 --- a/tests/perf/test-array-write.js +++ b/tests/perf/test-array-write.js @@ -6,7 +6,16 @@ function test() { var arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; var i; - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + arr[7] = 234; + arr[7] = 234; + arr[7] = 234; + arr[7] = 234; + arr[7] = 234; + arr[7] = 234; + arr[7] = 234; + arr[7] = 234; + arr[7] = 234; arr[7] = 234; } } diff --git a/tests/perf/test-array-write.lua b/tests/perf/test-array-write.lua index d4dfa224..4aa9193e 100644 --- a/tests/perf/test-array-write.lua +++ b/tests/perf/test-array-write.lua @@ -1,6 +1,15 @@ function test() local arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } - for i=1,1e8 do + for i=1,1e7 do + arr[8] = 234 + arr[8] = 234 + arr[8] = 234 + arr[8] = 234 + arr[8] = 234 + arr[8] = 234 + arr[8] = 234 + arr[8] = 234 + arr[8] = 234 arr[8] = 234 end end diff --git a/tests/perf/test-array-write.pl b/tests/perf/test-array-write.pl index c6aca990..3a0c8e2d 100644 --- a/tests/perf/test-array-write.pl +++ b/tests/perf/test-array-write.pl @@ -3,7 +3,16 @@ sub test { my $i; my $ign; - for ($i = 0; $i < 1e8; $i++) { + for ($i = 0; $i < 1e7; $i++) { + $arr[7] = 234; + $arr[7] = 234; + $arr[7] = 234; + $arr[7] = 234; + $arr[7] = 234; + $arr[7] = 234; + $arr[7] = 234; + $arr[7] = 234; + $arr[7] = 234; $arr[7] = 234; } } diff --git a/tests/perf/test-array-write.py b/tests/perf/test-array-write.py index 20fcd61e..4d0d36f6 100644 --- a/tests/perf/test-array-write.py +++ b/tests/perf/test-array-write.py @@ -1,7 +1,16 @@ def test(): arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; i = 0 - while i < 1e8: + while i < 1e7: + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 arr[7] = 234 i += 1 diff --git a/tests/perf/test-array-write.rb b/tests/perf/test-array-write.rb index 2dc3e2b9..fdd172bf 100644 --- a/tests/perf/test-array-write.rb +++ b/tests/perf/test-array-write.rb @@ -1,7 +1,16 @@ def test() arr = Array[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] i = 0 - while i < 1e8 do + while i < 1e7 do + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 + arr[7] = 234 arr[7] = 234 i += 1 end diff --git a/tests/perf/test-break-fast.js b/tests/perf/test-break-fast.js index c9f9b3f2..44b41b9c 100644 --- a/tests/perf/test-break-fast.js +++ b/tests/perf/test-break-fast.js @@ -1,6 +1,33 @@ function test() { var i; - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + do { + break; + } while (0); + do { + break; + } while (0); + do { + break; + } while (0); + do { + break; + } while (0); + do { + break; + } while (0); + do { + break; + } while (0); + do { + break; + } while (0); + do { + break; + } while (0); + do { + break; + } while (0); do { break; } while (0); diff --git a/tests/perf/test-break-slow.js b/tests/perf/test-break-slow.js index 3f92e7af..b9a06b7d 100644 --- a/tests/perf/test-break-slow.js +++ b/tests/perf/test-break-slow.js @@ -1,6 +1,60 @@ function test() { var i; - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + do { + try { + break; + } finally { + } + } while (0); + do { + try { + break; + } finally { + } + } while (0); + do { + try { + break; + } finally { + } + } while (0); + do { + try { + break; + } finally { + } + } while (0); + do { + try { + break; + } finally { + } + } while (0); + do { + try { + break; + } finally { + } + } while (0); + do { + try { + break; + } finally { + } + } while (0); + do { + try { + break; + } finally { + } + } while (0); + do { + try { + break; + } finally { + } + } while (0); do { try { break; diff --git a/tests/perf/test-buffer-nodejs-read.js b/tests/perf/test-buffer-nodejs-read.js index 7ef5284b..107b6f55 100644 --- a/tests/perf/test-buffer-nodejs-read.js +++ b/tests/perf/test-buffer-nodejs-read.js @@ -4,7 +4,16 @@ function test() { print(typeof b); - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; void b[100]; } } diff --git a/tests/perf/test-buffer-nodejs-write.js b/tests/perf/test-buffer-nodejs-write.js index 228e1600..0d77f3d5 100644 --- a/tests/perf/test-buffer-nodejs-write.js +++ b/tests/perf/test-buffer-nodejs-write.js @@ -4,7 +4,16 @@ function test() { print(typeof b); - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; b[100] = 123; } } diff --git a/tests/perf/test-buffer-object-read.js b/tests/perf/test-buffer-object-read.js index 727245e7..058ff48c 100644 --- a/tests/perf/test-buffer-object-read.js +++ b/tests/perf/test-buffer-object-read.js @@ -4,7 +4,16 @@ function test() { print(typeof b); - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; void b[100]; } } diff --git a/tests/perf/test-buffer-object-write.js b/tests/perf/test-buffer-object-write.js index 64958ff8..04bd81bf 100644 --- a/tests/perf/test-buffer-object-write.js +++ b/tests/perf/test-buffer-object-write.js @@ -4,7 +4,16 @@ function test() { print(typeof b); - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; b[100] = 123; } } diff --git a/tests/perf/test-buffer-plain-read.js b/tests/perf/test-buffer-plain-read.js index cd899c1d..3343f7e5 100644 --- a/tests/perf/test-buffer-plain-read.js +++ b/tests/perf/test-buffer-plain-read.js @@ -4,7 +4,16 @@ function test() { print(typeof b); - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; + void b[100]; void b[100]; } } diff --git a/tests/perf/test-buffer-plain-write.js b/tests/perf/test-buffer-plain-write.js index edd60bad..55001264 100644 --- a/tests/perf/test-buffer-plain-write.js +++ b/tests/perf/test-buffer-plain-write.js @@ -4,7 +4,16 @@ function test() { print(typeof b); - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; + b[100] = 123; b[100] = 123; } } diff --git a/tests/perf/test-call-basic.js b/tests/perf/test-call-basic.js index 97c1a487..881ac5cc 100644 --- a/tests/perf/test-call-basic.js +++ b/tests/perf/test-call-basic.js @@ -7,7 +7,16 @@ function test() { function f() { return; } - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + f(); + f(); + f(); + f(); + f(); + f(); + f(); + f(); + f(); f(); } } diff --git a/tests/perf/test-call-basic.lua b/tests/perf/test-call-basic.lua index 8ce903c0..26e2df0f 100644 --- a/tests/perf/test-call-basic.lua +++ b/tests/perf/test-call-basic.lua @@ -3,7 +3,16 @@ function test() return end - for i=1,1e8 do + for i=1,1e7 do + f() + f() + f() + f() + f() + f() + f() + f() + f() f() end end diff --git a/tests/perf/test-call-basic.pl b/tests/perf/test-call-basic.pl index ba74932f..94d008bc 100644 --- a/tests/perf/test-call-basic.pl +++ b/tests/perf/test-call-basic.pl @@ -4,7 +4,16 @@ sub test { sub f { return; } $i = 0; - for ($i = 0; $i < 1e8; $i++) { + for ($i = 0; $i < 1e7; $i++) { + f(); + f(); + f(); + f(); + f(); + f(); + f(); + f(); + f(); f(); } } diff --git a/tests/perf/test-call-basic.py b/tests/perf/test-call-basic.py index 05c3b523..521bcd2f 100644 --- a/tests/perf/test-call-basic.py +++ b/tests/perf/test-call-basic.py @@ -3,7 +3,16 @@ def test(): return i = 0 - while i < 1e8: + while i < 1e7: + f() + f() + f() + f() + f() + f() + f() + f() + f() f() i += 1 diff --git a/tests/perf/test-call-basic.rb b/tests/perf/test-call-basic.rb index 83b75d66..8dc623de 100644 --- a/tests/perf/test-call-basic.rb +++ b/tests/perf/test-call-basic.rb @@ -2,7 +2,16 @@ def test() def f() return end i = 0 - while i < 1e8 do + while i < 1e7 do + f() + f() + f() + f() + f() + f() + f() + f() + f() f() i += 1 end diff --git a/tests/perf/test-call-native.js b/tests/perf/test-call-native.js index 0ef924c8..0037a2b3 100644 --- a/tests/perf/test-call-native.js +++ b/tests/perf/test-call-native.js @@ -3,11 +3,20 @@ function test() { for (var i = 0; i < 1e3; i++) { arr[i] = i; } - for (var i = 0; i < 1e5; i++) { + for (var i = 0; i < 1e4; i++) { // Each .forEach() call is a native call so that return 123 causes a // return-to-native situation which was previously a longjmp. arr.forEach(function () { return 123; }); + arr.forEach(function () { return 123; }); + arr.forEach(function () { return 123; }); + arr.forEach(function () { return 123; }); + arr.forEach(function () { return 123; }); + arr.forEach(function () { return 123; }); + arr.forEach(function () { return 123; }); + arr.forEach(function () { return 123; }); + arr.forEach(function () { return 123; }); + arr.forEach(function () { return 123; }); } } diff --git a/tests/perf/test-compile-mandel-nofrac.js b/tests/perf/test-compile-mandel-nofrac.js index 8412c085..d7a194b5 100644 --- a/tests/perf/test-compile-mandel-nofrac.js +++ b/tests/perf/test-compile-mandel-nofrac.js @@ -7,7 +7,16 @@ function test() { var i; var src = "(function mandel() {\n var w = 80;\n var h = 40;\n var iter = 100;\n var i, j, k;\n var x0, y0, xx, yy, c, xx2, yy2;\n var res;\n\n for (i = 0; i - h; i += 1) {\n y0 = (i / h) * 4 - 2;\n\n res = [];\n\n for (j = 0; j - w; j += 1) {\n x0 = (j / w) * 4 - 2;\n\n xx = 0;\n yy = 0;\n c = \"#\";\n\n for (k = 0; k - iter; k += 1) {\n /* z -> z^2 + c\n * -> (xx+i*yy)^2 + (x0+i*y0)\n * -> xx*xx+i*2*xx*yy-yy*yy + x0 + i*y0\n * -> (xx*xx - yy*yy + x0) + i*(2*xx*yy + y0)\n */\n\n xx2 = xx*xx;\n yy2 = yy*yy;\n\n if (Math.max(0, 4 - (xx2 + yy2))) {\n yy = 2*xx*yy + y0;\n xx = xx2 - yy2 + x0;\n } else {\n /* xx^2 + yy^2 >= 4 */\n c = \".\";\n break;\n }\n }\n\n res[res.length] = c;\n }\n\n print(res.join(''));\n }\n})\n"; - for (i = 0; i < 1e5; i++) { + for (i = 0; i < 1e4; i++) { + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); void eval(src); } } diff --git a/tests/perf/test-compile-mandel.js b/tests/perf/test-compile-mandel.js index 23a285b0..85676fe7 100644 --- a/tests/perf/test-compile-mandel.js +++ b/tests/perf/test-compile-mandel.js @@ -2,7 +2,16 @@ function test() { var i; var src = "(function mandel() {\n var w = 80;\n var h = 40;\n var iter = 100;\n var i, j, k;\n var x0, y0, xx, yy, c, xx2, yy2;\n var res;\n\n for (i = 0; i - h; i += 1) {\n y0 = (i / h) * 4.0 - 2.0;\n\n res = [];\n\n for (j = 0; j - w; j += 1) {\n x0 = (j / w) * 4.0 - 2.0;\n\n xx = 0;\n yy = 0;\n c = \"#\";\n\n for (k = 0; k - iter; k += 1) {\n /* z -> z^2 + c\n * -> (xx+i*yy)^2 + (x0+i*y0)\n * -> xx*xx+i*2*xx*yy-yy*yy + x0 + i*y0\n * -> (xx*xx - yy*yy + x0) + i*(2*xx*yy + y0)\n */\n\n xx2 = xx*xx;\n yy2 = yy*yy;\n\n if (Math.max(0, 4.0 - (xx2 + yy2))) {\n yy = 2*xx*yy + y0;\n xx = xx2 - yy2 + x0;\n } else {\n /* xx^2 + yy^2 >= 4.0 */\n c = \".\";\n break;\n }\n }\n\n res[res.length] = c;\n }\n\n print(res.join(''));\n }\n})\n"; - for (i = 0; i < 1e5; i++) { + for (i = 0; i < 1e4; i++) { + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); void eval(src); } } diff --git a/tests/perf/test-compile-short.js b/tests/perf/test-compile-short.js index 45c46e50..fd2093b8 100644 --- a/tests/perf/test-compile-short.js +++ b/tests/perf/test-compile-short.js @@ -3,7 +3,16 @@ function test() { var src = '123 + myval'; var myval = 234; - for (i = 0; i < 1e6; i++) { + for (i = 0; i < 1e5; i++) { + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); + void eval(src); void eval(src); } } diff --git a/tests/perf/test-continue-fast.js b/tests/perf/test-continue-fast.js index 459b8a46..cd20a532 100644 --- a/tests/perf/test-continue-fast.js +++ b/tests/perf/test-continue-fast.js @@ -1,6 +1,33 @@ function test() { var i; - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + do { + continue; + } while (0); + do { + continue; + } while (0); + do { + continue; + } while (0); + do { + continue; + } while (0); + do { + continue; + } while (0); + do { + continue; + } while (0); + do { + continue; + } while (0); + do { + continue; + } while (0); + do { + continue; + } while (0); do { continue; } while (0); diff --git a/tests/perf/test-continue-slow.js b/tests/perf/test-continue-slow.js index 6821cdf7..a0f20b8e 100644 --- a/tests/perf/test-continue-slow.js +++ b/tests/perf/test-continue-slow.js @@ -1,6 +1,60 @@ function test() { var i; - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + do { + try { + continue; + } finally { + } + } while (0); + do { + try { + continue; + } finally { + } + } while (0); + do { + try { + continue; + } finally { + } + } while (0); + do { + try { + continue; + } finally { + } + } while (0); + do { + try { + continue; + } finally { + } + } while (0); + do { + try { + continue; + } finally { + } + } while (0); + do { + try { + continue; + } finally { + } + } while (0); + do { + try { + continue; + } finally { + } + } while (0); + do { + try { + continue; + } finally { + } + } while (0); do { try { continue; diff --git a/tests/perf/test-prop-read.js b/tests/perf/test-prop-read.js index 79919abe..bbb86e9d 100644 --- a/tests/perf/test-prop-read.js +++ b/tests/perf/test-prop-read.js @@ -7,7 +7,16 @@ function test() { var i; var ign; - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + ign = obj.foo; + ign = obj.foo; + ign = obj.foo; + ign = obj.foo; + ign = obj.foo; + ign = obj.foo; + ign = obj.foo; + ign = obj.foo; + ign = obj.foo; ign = obj.foo; } } diff --git a/tests/perf/test-prop-read.lua b/tests/perf/test-prop-read.lua index 59aaad86..ca1ba8eb 100644 --- a/tests/perf/test-prop-read.lua +++ b/tests/perf/test-prop-read.lua @@ -1,7 +1,17 @@ function test() local obj = { xxx1 = 1, xxx2 = 2, xxx3 = 3, xxx4 = 4, foo = 123 } - for i=1,1e8 do - local ign = obj.foo + local ign + for i=1,1e7 do + ign = obj.foo + ign = obj.foo + ign = obj.foo + ign = obj.foo + ign = obj.foo + ign = obj.foo + ign = obj.foo + ign = obj.foo + ign = obj.foo + ign = obj.foo end end diff --git a/tests/perf/test-prop-read.pl b/tests/perf/test-prop-read.pl index 9a8e73d7..24c24867 100644 --- a/tests/perf/test-prop-read.pl +++ b/tests/perf/test-prop-read.pl @@ -3,7 +3,16 @@ sub test { my $i; my $ign; - for ($i = 0; $i < 1e8; $i++) { + for ($i = 0; $i < 1e7; $i++) { + $ign = $obj{'foo'}; + $ign = $obj{'foo'}; + $ign = $obj{'foo'}; + $ign = $obj{'foo'}; + $ign = $obj{'foo'}; + $ign = $obj{'foo'}; + $ign = $obj{'foo'}; + $ign = $obj{'foo'}; + $ign = $obj{'foo'}; $ign = $obj{'foo'}; } } diff --git a/tests/perf/test-prop-read.py b/tests/perf/test-prop-read.py index 69112557..0882f686 100644 --- a/tests/perf/test-prop-read.py +++ b/tests/perf/test-prop-read.py @@ -1,7 +1,16 @@ def test(): obj = { 'xxx1': 1, 'xxx2': 2, 'xxx3': 3, 'xxx4': 4, 'foo': 123 } i = 0 - while i < 1e8: + while i < 1e7: + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] ign = obj['foo'] i += 1 diff --git a/tests/perf/test-prop-read.rb b/tests/perf/test-prop-read.rb index 24e324be..849791de 100644 --- a/tests/perf/test-prop-read.rb +++ b/tests/perf/test-prop-read.rb @@ -2,7 +2,16 @@ def test() obj = Hash["xxx1" => 1, "xxx2" => 2, "xxx3" => 3, "xxx4" => 4, "foo" => 123]; i = 0 - while i < 1e8 do + while i < 1e7 do + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] + ign = obj['foo'] ign = obj['foo'] i += 1 end diff --git a/tests/perf/test-prop-write.js b/tests/perf/test-prop-write.js index 1cfd8b90..65053525 100644 --- a/tests/perf/test-prop-write.js +++ b/tests/perf/test-prop-write.js @@ -6,7 +6,16 @@ function test() { var obj = { xxx1: 1, xxx2: 2, xxx3: 3, xxx4: 4, foo: 123 }; var i; - for (i = 0; i < 1e8; i++) { + for (i = 0; i < 1e7; i++) { + obj.foo = 234; + obj.foo = 234; + obj.foo = 234; + obj.foo = 234; + obj.foo = 234; + obj.foo = 234; + obj.foo = 234; + obj.foo = 234; + obj.foo = 234; obj.foo = 234; } } diff --git a/tests/perf/test-prop-write.lua b/tests/perf/test-prop-write.lua index d6a1a51d..cf51b82a 100644 --- a/tests/perf/test-prop-write.lua +++ b/tests/perf/test-prop-write.lua @@ -1,6 +1,15 @@ function test() local obj = { xxx1 = 1, xxx2 = 2, xxx3 = 3, xxx4 = 4, foo = 123 } - for i=1,1e8 do + for i=1,1e7 do + obj.foo = 234 + obj.foo = 234 + obj.foo = 234 + obj.foo = 234 + obj.foo = 234 + obj.foo = 234 + obj.foo = 234 + obj.foo = 234 + obj.foo = 234 obj.foo = 234 end end diff --git a/tests/perf/test-prop-write.pl b/tests/perf/test-prop-write.pl index b1be3aed..ca40080d 100644 --- a/tests/perf/test-prop-write.pl +++ b/tests/perf/test-prop-write.pl @@ -2,7 +2,16 @@ sub test { my %obj = ( 'xxx1' => 1, 'xxx2' => 2, 'xxx3' => 3, 'xxx4' => 4, 'foo' => 123 ); my $i; - for ($i = 0; $i < 1e8; $i++) { + for ($i = 0; $i < 1e7; $i++) { + $obj{'foo'} = 234; + $obj{'foo'} = 234; + $obj{'foo'} = 234; + $obj{'foo'} = 234; + $obj{'foo'} = 234; + $obj{'foo'} = 234; + $obj{'foo'} = 234; + $obj{'foo'} = 234; + $obj{'foo'} = 234; $obj{'foo'} = 234; } } diff --git a/tests/perf/test-prop-write.py b/tests/perf/test-prop-write.py index 7346c6e5..395daf0a 100644 --- a/tests/perf/test-prop-write.py +++ b/tests/perf/test-prop-write.py @@ -1,7 +1,16 @@ def test(): obj = { 'xxx1': 1, 'xxx2': 2, 'xxx3': 4, 'xxx4': 4, 'foo': 123 } i = 0 - while i < 1e8: + while i < 1e7: + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 obj['foo'] = 234 i += 1 diff --git a/tests/perf/test-prop-write.rb b/tests/perf/test-prop-write.rb index 5d49d41f..a82d61a4 100644 --- a/tests/perf/test-prop-write.rb +++ b/tests/perf/test-prop-write.rb @@ -2,7 +2,16 @@ def test() obj = Hash["xxx1" => 1, "xxx2" => 2, "xxx3" => 3, "xxx4" => 4, "foo" => 123]; i = 0 - while i < 1e8 do + while i < 1e7 do + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 + obj['foo'] = 234 obj['foo'] = 234 i += 1 end diff --git a/tests/perf/test-regexp-string-parse.js b/tests/perf/test-regexp-string-parse.js index 7f00308f..702bcc9d 100644 --- a/tests/perf/test-regexp-string-parse.js +++ b/tests/perf/test-regexp-string-parse.js @@ -15,7 +15,16 @@ function test() { var regexpdata = '/' + txt + '/'; // periods will be wildcards print(regexpdata.length); - for (i = 0; i < 1000; i++) { + for (i = 0; i < 100; i++) { + void new RegExp(regexpdata); + void new RegExp(regexpdata); + void new RegExp(regexpdata); + void new RegExp(regexpdata); + void new RegExp(regexpdata); + void new RegExp(regexpdata); + void new RegExp(regexpdata); + void new RegExp(regexpdata); + void new RegExp(regexpdata); void new RegExp(regexpdata); } } diff --git a/tests/perf/test-regexp-string-parse.py b/tests/perf/test-regexp-string-parse.py index fac73530..5188270f 100644 --- a/tests/perf/test-regexp-string-parse.py +++ b/tests/perf/test-regexp-string-parse.py @@ -9,7 +9,16 @@ def test(): regexpdata = '/' + txt + '/' print(len(regexpdata)) - for i in xrange(1000): + for i in xrange(100): + ign = re.compile(regexpdata) + ign = re.compile(regexpdata) + ign = re.compile(regexpdata) + ign = re.compile(regexpdata) + ign = re.compile(regexpdata) + ign = re.compile(regexpdata) + ign = re.compile(regexpdata) + ign = re.compile(regexpdata) + ign = re.compile(regexpdata) ign = re.compile(regexpdata) test()