From 424d99475f1d350610d93679fe16e61137e5b44a Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Tue, 17 Jun 2014 17:20:08 +0300 Subject: [PATCH 1/2] Initial set of simple specific perf tests --- perf-testcases/test-array-read.js | 19 +++ perf-testcases/test-array-read.lua | 8 ++ perf-testcases/test-array-read.pl | 11 ++ perf-testcases/test-array-read.py | 8 ++ perf-testcases/test-array-read.rb | 10 ++ perf-testcases/test-array-write.js | 18 +++ perf-testcases/test-array-write.lua | 8 ++ perf-testcases/test-array-write.pl | 11 ++ perf-testcases/test-array-write.py | 8 ++ perf-testcases/test-array-write.rb | 10 ++ perf-testcases/test-bitwise-ops.js | 23 +++ perf-testcases/test-call-basic.js | 21 +++ perf-testcases/test-call-basic.lua | 11 ++ perf-testcases/test-call-basic.pl | 12 ++ perf-testcases/test-call-basic.py | 10 ++ perf-testcases/test-call-basic.rb | 11 ++ perf-testcases/test-empty-loop.js | 12 ++ perf-testcases/test-empty-loop.lua | 6 + perf-testcases/test-empty-loop.pl | 8 ++ perf-testcases/test-empty-loop.py | 6 + perf-testcases/test-empty-loop.rb | 8 ++ perf-testcases/test-fib.js | 13 ++ perf-testcases/test-fib.lua | 9 ++ perf-testcases/test-fib.pl | 9 ++ perf-testcases/test-fib.py | 7 + perf-testcases/test-fib.rb | 9 ++ perf-testcases/test-hello-world.js | 3 + perf-testcases/test-hello-world.lua | 3 + perf-testcases/test-hello-world.pl | 1 + perf-testcases/test-hello-world.py | 1 + perf-testcases/test-hello-world.rb | 1 + perf-testcases/test-hex-decode.js | 26 ++++ perf-testcases/test-hex-decode.py | 21 +++ perf-testcases/test-json-serialize.js | 30 ++++ perf-testcases/test-json-serialize.py | 22 +++ perf-testcases/test-json-string-bench.js | 37 +++++ perf-testcases/test-prop-read.js | 19 +++ perf-testcases/test-prop-read.lua | 8 ++ perf-testcases/test-prop-read.pl | 11 ++ perf-testcases/test-prop-read.py | 8 ++ perf-testcases/test-prop-read.rb | 11 ++ perf-testcases/test-prop-write.js | 18 +++ perf-testcases/test-prop-write.lua | 8 ++ perf-testcases/test-prop-write.pl | 10 ++ perf-testcases/test-prop-write.py | 8 ++ perf-testcases/test-prop-write.rb | 11 ++ perf-testcases/test-reg-readwrite-object.js | 139 +++++++++++++++++++ perf-testcases/test-reg-readwrite-object.lua | 132 ++++++++++++++++++ perf-testcases/test-reg-readwrite-object.pl | 130 +++++++++++++++++ perf-testcases/test-reg-readwrite-object.py | 131 +++++++++++++++++ perf-testcases/test-reg-readwrite-object.rb | 130 +++++++++++++++++ perf-testcases/test-reg-readwrite-plain.js | 139 +++++++++++++++++++ perf-testcases/test-reg-readwrite-plain.lua | 132 ++++++++++++++++++ perf-testcases/test-reg-readwrite-plain.pl | 130 +++++++++++++++++ perf-testcases/test-reg-readwrite-plain.py | 131 +++++++++++++++++ perf-testcases/test-reg-readwrite-plain.rb | 130 +++++++++++++++++ 56 files changed, 1867 insertions(+) create mode 100644 perf-testcases/test-array-read.js create mode 100644 perf-testcases/test-array-read.lua create mode 100644 perf-testcases/test-array-read.pl create mode 100644 perf-testcases/test-array-read.py create mode 100644 perf-testcases/test-array-read.rb create mode 100644 perf-testcases/test-array-write.js create mode 100644 perf-testcases/test-array-write.lua create mode 100644 perf-testcases/test-array-write.pl create mode 100644 perf-testcases/test-array-write.py create mode 100644 perf-testcases/test-array-write.rb create mode 100644 perf-testcases/test-bitwise-ops.js create mode 100644 perf-testcases/test-call-basic.js create mode 100644 perf-testcases/test-call-basic.lua create mode 100644 perf-testcases/test-call-basic.pl create mode 100644 perf-testcases/test-call-basic.py create mode 100644 perf-testcases/test-call-basic.rb create mode 100644 perf-testcases/test-empty-loop.js create mode 100644 perf-testcases/test-empty-loop.lua create mode 100644 perf-testcases/test-empty-loop.pl create mode 100644 perf-testcases/test-empty-loop.py create mode 100644 perf-testcases/test-empty-loop.rb create mode 100644 perf-testcases/test-fib.js create mode 100644 perf-testcases/test-fib.lua create mode 100644 perf-testcases/test-fib.pl create mode 100644 perf-testcases/test-fib.py create mode 100644 perf-testcases/test-fib.rb create mode 100644 perf-testcases/test-hello-world.js create mode 100644 perf-testcases/test-hello-world.lua create mode 100644 perf-testcases/test-hello-world.pl create mode 100644 perf-testcases/test-hello-world.py create mode 100644 perf-testcases/test-hello-world.rb create mode 100644 perf-testcases/test-hex-decode.js create mode 100644 perf-testcases/test-hex-decode.py create mode 100644 perf-testcases/test-json-serialize.js create mode 100644 perf-testcases/test-json-serialize.py create mode 100644 perf-testcases/test-json-string-bench.js create mode 100644 perf-testcases/test-prop-read.js create mode 100644 perf-testcases/test-prop-read.lua create mode 100644 perf-testcases/test-prop-read.pl create mode 100644 perf-testcases/test-prop-read.py create mode 100644 perf-testcases/test-prop-read.rb create mode 100644 perf-testcases/test-prop-write.js create mode 100644 perf-testcases/test-prop-write.lua create mode 100644 perf-testcases/test-prop-write.pl create mode 100644 perf-testcases/test-prop-write.py create mode 100644 perf-testcases/test-prop-write.rb create mode 100644 perf-testcases/test-reg-readwrite-object.js create mode 100644 perf-testcases/test-reg-readwrite-object.lua create mode 100644 perf-testcases/test-reg-readwrite-object.pl create mode 100644 perf-testcases/test-reg-readwrite-object.py create mode 100644 perf-testcases/test-reg-readwrite-object.rb create mode 100644 perf-testcases/test-reg-readwrite-plain.js create mode 100644 perf-testcases/test-reg-readwrite-plain.lua create mode 100644 perf-testcases/test-reg-readwrite-plain.pl create mode 100644 perf-testcases/test-reg-readwrite-plain.py create mode 100644 perf-testcases/test-reg-readwrite-plain.rb diff --git a/perf-testcases/test-array-read.js b/perf-testcases/test-array-read.js new file mode 100644 index 00000000..75224d84 --- /dev/null +++ b/perf-testcases/test-array-read.js @@ -0,0 +1,19 @@ +/* + * Basic array read performance + */ + +function test() { + var arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; + var i; + var ign; + + for (i = 0; i < 1e8; i++) { + ign = arr[7]; + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-array-read.lua b/perf-testcases/test-array-read.lua new file mode 100644 index 00000000..95ad58a7 --- /dev/null +++ b/perf-testcases/test-array-read.lua @@ -0,0 +1,8 @@ +function test() + local arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } + for i=1,1e8 do + local ign = arr[8] + end +end + +test() diff --git a/perf-testcases/test-array-read.pl b/perf-testcases/test-array-read.pl new file mode 100644 index 00000000..fc89ba73 --- /dev/null +++ b/perf-testcases/test-array-read.pl @@ -0,0 +1,11 @@ +sub test { + my @arr = ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); + my $i; + my $ign; + + for ($i = 0; $i < 1e8; $i++) { + $ign = $arr[7]; + } +} + +test(); diff --git a/perf-testcases/test-array-read.py b/perf-testcases/test-array-read.py new file mode 100644 index 00000000..7a7c9fff --- /dev/null +++ b/perf-testcases/test-array-read.py @@ -0,0 +1,8 @@ +def test(): + arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; + i = 0 + while i < 1e8: + ign = arr[7] + i += 1 + +test() diff --git a/perf-testcases/test-array-read.rb b/perf-testcases/test-array-read.rb new file mode 100644 index 00000000..9116097a --- /dev/null +++ b/perf-testcases/test-array-read.rb @@ -0,0 +1,10 @@ +def test() + arr = Array[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] + i = 0 + while i < 1e8 do + ign = arr[7] + i += 1 + end +end + +test() diff --git a/perf-testcases/test-array-write.js b/perf-testcases/test-array-write.js new file mode 100644 index 00000000..88d62357 --- /dev/null +++ b/perf-testcases/test-array-write.js @@ -0,0 +1,18 @@ +/* + * Basic array write performance + */ + +function test() { + var arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; + var i; + + for (i = 0; i < 1e8; i++) { + arr[7] = 234; + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-array-write.lua b/perf-testcases/test-array-write.lua new file mode 100644 index 00000000..d4dfa224 --- /dev/null +++ b/perf-testcases/test-array-write.lua @@ -0,0 +1,8 @@ +function test() + local arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } + for i=1,1e8 do + arr[8] = 234 + end +end + +test() diff --git a/perf-testcases/test-array-write.pl b/perf-testcases/test-array-write.pl new file mode 100644 index 00000000..c6aca990 --- /dev/null +++ b/perf-testcases/test-array-write.pl @@ -0,0 +1,11 @@ +sub test { + my @arr = ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); + my $i; + my $ign; + + for ($i = 0; $i < 1e8; $i++) { + $arr[7] = 234; + } +} + +test(); diff --git a/perf-testcases/test-array-write.py b/perf-testcases/test-array-write.py new file mode 100644 index 00000000..20fcd61e --- /dev/null +++ b/perf-testcases/test-array-write.py @@ -0,0 +1,8 @@ +def test(): + arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; + i = 0 + while i < 1e8: + arr[7] = 234 + i += 1 + +test() diff --git a/perf-testcases/test-array-write.rb b/perf-testcases/test-array-write.rb new file mode 100644 index 00000000..2dc3e2b9 --- /dev/null +++ b/perf-testcases/test-array-write.rb @@ -0,0 +1,10 @@ +def test() + arr = Array[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] + i = 0 + while i < 1e8 do + arr[7] = 234 + i += 1 + end +end + +test() diff --git a/perf-testcases/test-bitwise-ops.js b/perf-testcases/test-bitwise-ops.js new file mode 100644 index 00000000..0aa3bb49 --- /dev/null +++ b/perf-testcases/test-bitwise-ops.js @@ -0,0 +1,23 @@ +function test() { + var x, y, z; + var i, n; + + x = 0xdeadbeef; + y = 0xcafed00d; + + for (i = 0, n = 1e7; i < n; i++) { + z = x & y; + z = x | y; + z = x ^ y; + z = x << y; + z = x >> y; + z = x >>> y; + z = ~x; + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-call-basic.js b/perf-testcases/test-call-basic.js new file mode 100644 index 00000000..725d6fe0 --- /dev/null +++ b/perf-testcases/test-call-basic.js @@ -0,0 +1,21 @@ +/* + * Basic function call performance. + * + * Focuses on the cases where "fast returns" are possible. + */ + +function test() { + var i; + + function f() { return; } + + for (i = 0; i < 1e8; i++) { + f(); + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-call-basic.lua b/perf-testcases/test-call-basic.lua new file mode 100644 index 00000000..8ce903c0 --- /dev/null +++ b/perf-testcases/test-call-basic.lua @@ -0,0 +1,11 @@ +function test() + local function f() + return + end + + for i=1,1e8 do + f() + end +end + +test() diff --git a/perf-testcases/test-call-basic.pl b/perf-testcases/test-call-basic.pl new file mode 100644 index 00000000..5fbbf587 --- /dev/null +++ b/perf-testcases/test-call-basic.pl @@ -0,0 +1,12 @@ +sub test { + my $i; + + sub f { return; } + + $i = 0; + for ($i = 0; $i < 1e8; $i++) { + f(); + } +} + +test(); diff --git a/perf-testcases/test-call-basic.py b/perf-testcases/test-call-basic.py new file mode 100644 index 00000000..05c3b523 --- /dev/null +++ b/perf-testcases/test-call-basic.py @@ -0,0 +1,10 @@ +def test(): + def f(): + return + + i = 0 + while i < 1e8: + f() + i += 1 + +test() diff --git a/perf-testcases/test-call-basic.rb b/perf-testcases/test-call-basic.rb new file mode 100644 index 00000000..89c4bf81 --- /dev/null +++ b/perf-testcases/test-call-basic.rb @@ -0,0 +1,11 @@ +def test() + def f() return end + + i = 0 + while i < 1e8 do + f() + i += 1 + end +end + +test() diff --git a/perf-testcases/test-empty-loop.js b/perf-testcases/test-empty-loop.js new file mode 100644 index 00000000..48fc3f32 --- /dev/null +++ b/perf-testcases/test-empty-loop.js @@ -0,0 +1,12 @@ +function test() { + var i; + + for (i = 0; i < 1e8; i++) { + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-empty-loop.lua b/perf-testcases/test-empty-loop.lua new file mode 100644 index 00000000..dc64a014 --- /dev/null +++ b/perf-testcases/test-empty-loop.lua @@ -0,0 +1,6 @@ +local function test() + local i = 0 + while i < 1e8 do i = i + 1 end + --for i=1,1e8 do end +end +test() diff --git a/perf-testcases/test-empty-loop.pl b/perf-testcases/test-empty-loop.pl new file mode 100644 index 00000000..bd261646 --- /dev/null +++ b/perf-testcases/test-empty-loop.pl @@ -0,0 +1,8 @@ +sub test { + my $i; + + for ($i = 0; $i < 1e8; $i++) { + } +} + +test(); diff --git a/perf-testcases/test-empty-loop.py b/perf-testcases/test-empty-loop.py new file mode 100644 index 00000000..ec569053 --- /dev/null +++ b/perf-testcases/test-empty-loop.py @@ -0,0 +1,6 @@ +def test(): + i = 0 + while i < 1e8: + i += 1 + +test() diff --git a/perf-testcases/test-empty-loop.rb b/perf-testcases/test-empty-loop.rb new file mode 100644 index 00000000..b6e43679 --- /dev/null +++ b/perf-testcases/test-empty-loop.rb @@ -0,0 +1,8 @@ +def test() + i = 0 + while i < 1e8 do + i += 1 + end +end + +test() diff --git a/perf-testcases/test-fib.js b/perf-testcases/test-fib.js new file mode 100644 index 00000000..81810569 --- /dev/null +++ b/perf-testcases/test-fib.js @@ -0,0 +1,13 @@ +/* + * Fibonacci test, exercises call handling and recursion + */ + +function fib(n) { + return n <= 1 ? n : fib(n - 2) + fib(n - 1); +} + +try { + print(fib(35)); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-fib.lua b/perf-testcases/test-fib.lua new file mode 100644 index 00000000..d4524743 --- /dev/null +++ b/perf-testcases/test-fib.lua @@ -0,0 +1,9 @@ +function fib(n) + if n <= 1 then + return n + else + return fib(n - 2) + fib(n - 1) + end +end + +print(fib(35)) diff --git a/perf-testcases/test-fib.pl b/perf-testcases/test-fib.pl new file mode 100644 index 00000000..b569517e --- /dev/null +++ b/perf-testcases/test-fib.pl @@ -0,0 +1,9 @@ +sub fib { + my $n = shift; + if ($n <= 1) { + return $n; + } else { + return fib($n - 2) + fib($n - 1); + } +} +print fib(35) . "\n"; diff --git a/perf-testcases/test-fib.py b/perf-testcases/test-fib.py new file mode 100644 index 00000000..cb7ded7c --- /dev/null +++ b/perf-testcases/test-fib.py @@ -0,0 +1,7 @@ +def fib(n): + if n <= 1: + return n + else: + return fib(n - 2) + fib(n - 1) + +print(fib(35)) diff --git a/perf-testcases/test-fib.rb b/perf-testcases/test-fib.rb new file mode 100644 index 00000000..130cc28e --- /dev/null +++ b/perf-testcases/test-fib.rb @@ -0,0 +1,9 @@ +def fib(n) + if n <= 1 then + return n + else + return fib(n - 2) + fib(n - 1) + end +end + +print(fib(35).to_s + "\n") diff --git a/perf-testcases/test-hello-world.js b/perf-testcases/test-hello-world.js new file mode 100644 index 00000000..bd6da21a --- /dev/null +++ b/perf-testcases/test-hello-world.js @@ -0,0 +1,3 @@ +// Hello world test for memory testing + +print('Hello world!'); diff --git a/perf-testcases/test-hello-world.lua b/perf-testcases/test-hello-world.lua new file mode 100644 index 00000000..579bbdec --- /dev/null +++ b/perf-testcases/test-hello-world.lua @@ -0,0 +1,3 @@ +-- Hello world test for memory testing. + +print('hello world!') diff --git a/perf-testcases/test-hello-world.pl b/perf-testcases/test-hello-world.pl new file mode 100644 index 00000000..94ed8123 --- /dev/null +++ b/perf-testcases/test-hello-world.pl @@ -0,0 +1 @@ +print("Hello world!\n"); diff --git a/perf-testcases/test-hello-world.py b/perf-testcases/test-hello-world.py new file mode 100644 index 00000000..60f08aa4 --- /dev/null +++ b/perf-testcases/test-hello-world.py @@ -0,0 +1 @@ +print('Hello world!') diff --git a/perf-testcases/test-hello-world.rb b/perf-testcases/test-hello-world.rb new file mode 100644 index 00000000..94ed8123 --- /dev/null +++ b/perf-testcases/test-hello-world.rb @@ -0,0 +1 @@ +print("Hello world!\n"); diff --git a/perf-testcases/test-hex-decode.js b/perf-testcases/test-hex-decode.js new file mode 100644 index 00000000..b829150b --- /dev/null +++ b/perf-testcases/test-hex-decode.js @@ -0,0 +1,26 @@ +function test() { + var tmp1 = []; + var tmp2 = []; + var i, n; + + print('build'); + for (i = 0; i < 1024; i++) { + tmp1.push(Math.floor(Math.random() * 16).toString(16)) + } + tmp1 = tmp1.join(''); + for (i = 0; i < 1024; i++) { + tmp2.push(tmp1); + } + tmp2 = tmp2.join(''); + + print('run'); + for (i = 0; i < 10000; i++) { + Duktape.dec('hex', tmp2); + } +} + +if (typeof Duktape === 'object') { + test(); +} else { + // Ignore on e.g. Rhino +} diff --git a/perf-testcases/test-hex-decode.py b/perf-testcases/test-hex-decode.py new file mode 100644 index 00000000..dd230b92 --- /dev/null +++ b/perf-testcases/test-hex-decode.py @@ -0,0 +1,21 @@ +import math +import random + +def test(): + tmp1 = [] + tmp2 = [] + + print('build') + for i in xrange(1024): + tmp1.append('%x' % math.floor(random.random() * 16)) + tmp1 = ''.join(tmp1) + for i in xrange(1024): + tmp2.append(tmp1) + tmp2 = ''.join(tmp2) + + #print(len(tmp2)) + print('run') + for i in xrange(10000): + ign = tmp2.decode('hex') + +test() diff --git a/perf-testcases/test-json-serialize.js b/perf-testcases/test-json-serialize.js new file mode 100644 index 00000000..29738b0a --- /dev/null +++ b/perf-testcases/test-json-serialize.js @@ -0,0 +1,30 @@ +function build() { + var obj = {}; + + obj.key1 = 'foo'; + obj.key2 = 'bar'; + obj.key3 = 'quux'; + obj.key4 = 'baz'; + obj.key5 = 'quuux'; + obj.key6 = [ 'foo', 'bar', 'quux', 'baz', 'quuux' ]; + obj.key7 = [ undefined, null, true, 123.456, 1e200, {}, {}, {} ]; + + return obj; +} + +function test() { + var obj; + var i; + var ignore; + + obj = build(); + for (i = 0; i < 1e5; i++) { + ignore = JSON.stringify(obj); + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-json-serialize.py b/perf-testcases/test-json-serialize.py new file mode 100644 index 00000000..6bac4cb2 --- /dev/null +++ b/perf-testcases/test-json-serialize.py @@ -0,0 +1,22 @@ +import json + +def build(): + obj = {} + obj['key1'] = 'foo' + obj['key2'] = 'bar' + obj['key3'] = 'quux' + obj['key4'] = 'baz' + obj['key5'] = 'quuux' + obj['key6'] = [ 'foo', 'bar', 'quux', 'baz', 'quuux' ] + obj['key7'] = [ None, None, True, 123.456, 1e200, {}, {}, {} ] + + return obj + +def test(): + obj = build() + i = 0 + while i < 1e5: + ignore = json.dumps(obj) + i += 1 + +test() diff --git a/perf-testcases/test-json-string-bench.js b/perf-testcases/test-json-string-bench.js new file mode 100644 index 00000000..b7149e1c --- /dev/null +++ b/perf-testcases/test-json-string-bench.js @@ -0,0 +1,37 @@ +function rndAscii(len) { + var res = []; + var i; + for (i = 0; i < len; i++) { + if (Math.random() < 0.08) { + res.push(String.fromCharCode(Math.floor(Math.random() * 128))); + } else { + res.push(String.fromCharCode(Math.floor(Math.random() * 0x5f) + 0x20)); + } + } + return res.join(''); +} + +function test() { + var sz = 1; + + for (var i = 0; i <= 20; i++) { + var s = rndAscii(sz); + var obj = { key: s }; + var start = Date.now(); + var ign = JSON.stringify(obj); + //print(ign); + var end = Date.now(); + var diff = end - start; + print(sz, start, end, diff, + diff * 1000 / sz, // microseconds/byte + (sz / (1024 * 1024)) / (diff / 1000) // megabytes/second + ); + sz *= 2; + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-prop-read.js b/perf-testcases/test-prop-read.js new file mode 100644 index 00000000..a7cb27ac --- /dev/null +++ b/perf-testcases/test-prop-read.js @@ -0,0 +1,19 @@ +/* + * Basic property read performance + */ + +function test() { + var obj = { xxx1: 1, xxx2: 2, xxx3: 3, xxx4: 4, foo: 123 }; + var i; + var ign; + + for (i = 0; i < 1e8; i++) { + ign = obj.foo; + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-prop-read.lua b/perf-testcases/test-prop-read.lua new file mode 100644 index 00000000..59aaad86 --- /dev/null +++ b/perf-testcases/test-prop-read.lua @@ -0,0 +1,8 @@ +function test() + local obj = { xxx1 = 1, xxx2 = 2, xxx3 = 3, xxx4 = 4, foo = 123 } + for i=1,1e8 do + local ign = obj.foo + end +end + +test() diff --git a/perf-testcases/test-prop-read.pl b/perf-testcases/test-prop-read.pl new file mode 100644 index 00000000..9a8e73d7 --- /dev/null +++ b/perf-testcases/test-prop-read.pl @@ -0,0 +1,11 @@ +sub test { + my %obj = ( 'xxx1' => 1, 'xxx2' => 2, 'xxx3' => 3, 'xxx4' => 4, 'foo' => 123 ); + my $i; + my $ign; + + for ($i = 0; $i < 1e8; $i++) { + $ign = $obj{'foo'}; + } +} + +test(); diff --git a/perf-testcases/test-prop-read.py b/perf-testcases/test-prop-read.py new file mode 100644 index 00000000..69112557 --- /dev/null +++ b/perf-testcases/test-prop-read.py @@ -0,0 +1,8 @@ +def test(): + obj = { 'xxx1': 1, 'xxx2': 2, 'xxx3': 3, 'xxx4': 4, 'foo': 123 } + i = 0 + while i < 1e8: + ign = obj['foo'] + i += 1 + +test() diff --git a/perf-testcases/test-prop-read.rb b/perf-testcases/test-prop-read.rb new file mode 100644 index 00000000..24e324be --- /dev/null +++ b/perf-testcases/test-prop-read.rb @@ -0,0 +1,11 @@ +def test() + obj = Hash["xxx1" => 1, "xxx2" => 2, "xxx3" => 3, "xxx4" => 4, "foo" => 123]; + + i = 0 + while i < 1e8 do + ign = obj['foo'] + i += 1 + end +end + +test() diff --git a/perf-testcases/test-prop-write.js b/perf-testcases/test-prop-write.js new file mode 100644 index 00000000..64492615 --- /dev/null +++ b/perf-testcases/test-prop-write.js @@ -0,0 +1,18 @@ +/* + * Basic property write performance + */ + +function test() { + var obj = { xxx1: 1, xxx2: 2, xxx3: 3, xxx4: 4, foo: 123 }; + var i; + + for (i = 0; i < 1e8; i++) { + obj.foo = 234; + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-prop-write.lua b/perf-testcases/test-prop-write.lua new file mode 100644 index 00000000..d6a1a51d --- /dev/null +++ b/perf-testcases/test-prop-write.lua @@ -0,0 +1,8 @@ +function test() + local obj = { xxx1 = 1, xxx2 = 2, xxx3 = 3, xxx4 = 4, foo = 123 } + for i=1,1e8 do + obj.foo = 234 + end +end + +test() diff --git a/perf-testcases/test-prop-write.pl b/perf-testcases/test-prop-write.pl new file mode 100644 index 00000000..b1be3aed --- /dev/null +++ b/perf-testcases/test-prop-write.pl @@ -0,0 +1,10 @@ +sub test { + my %obj = ( 'xxx1' => 1, 'xxx2' => 2, 'xxx3' => 3, 'xxx4' => 4, 'foo' => 123 ); + my $i; + + for ($i = 0; $i < 1e8; $i++) { + $obj{'foo'} = 234; + } +} + +test(); diff --git a/perf-testcases/test-prop-write.py b/perf-testcases/test-prop-write.py new file mode 100644 index 00000000..7346c6e5 --- /dev/null +++ b/perf-testcases/test-prop-write.py @@ -0,0 +1,8 @@ +def test(): + obj = { 'xxx1': 1, 'xxx2': 2, 'xxx3': 4, 'xxx4': 4, 'foo': 123 } + i = 0 + while i < 1e8: + obj['foo'] = 234 + i += 1 + +test() diff --git a/perf-testcases/test-prop-write.rb b/perf-testcases/test-prop-write.rb new file mode 100644 index 00000000..5d49d41f --- /dev/null +++ b/perf-testcases/test-prop-write.rb @@ -0,0 +1,11 @@ +def test() + obj = Hash["xxx1" => 1, "xxx2" => 2, "xxx3" => 3, "xxx4" => 4, "foo" => 123]; + + i = 0 + while i < 1e8 do + obj['foo'] = 234 + i += 1 + end +end + +test() diff --git a/perf-testcases/test-reg-readwrite-object.js b/perf-testcases/test-reg-readwrite-object.js new file mode 100644 index 00000000..f66c0dfe --- /dev/null +++ b/perf-testcases/test-reg-readwrite-object.js @@ -0,0 +1,139 @@ +/* + * Test bytecode register assignments with object values. Involves only + * a dispatch and a tval copy for a heap-allocated tval. + */ + +function test() { + var a, b, c, d; + var i; + + a = {}; b = {}; c = {}; d = {}; + + for (i = 0; i < 1e6; i++) { + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-reg-readwrite-object.lua b/perf-testcases/test-reg-readwrite-object.lua new file mode 100644 index 00000000..eee77d5f --- /dev/null +++ b/perf-testcases/test-reg-readwrite-object.lua @@ -0,0 +1,132 @@ +function test() + local a, b, c, d, i; + + a = {} + b = {} + c = {} + d = {} + + for i=1,1e6 do + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + end +end + +test() diff --git a/perf-testcases/test-reg-readwrite-object.pl b/perf-testcases/test-reg-readwrite-object.pl new file mode 100644 index 00000000..feb1f576 --- /dev/null +++ b/perf-testcases/test-reg-readwrite-object.pl @@ -0,0 +1,130 @@ +sub test { + my $a, $b, $c, $d; + my $i; + + $a = (); $b = (); $c = (); $d = (); + + for ($i = 0; $i < 1e6; $i++) { + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + } +} + +test(); diff --git a/perf-testcases/test-reg-readwrite-object.py b/perf-testcases/test-reg-readwrite-object.py new file mode 100644 index 00000000..89724d58 --- /dev/null +++ b/perf-testcases/test-reg-readwrite-object.py @@ -0,0 +1,131 @@ +def test(): + a = {} + b = {} + c = {} + d = {} + + i = 0 + while i < 1e6: + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + i += 1 + +test() diff --git a/perf-testcases/test-reg-readwrite-object.rb b/perf-testcases/test-reg-readwrite-object.rb new file mode 100644 index 00000000..3fef032f --- /dev/null +++ b/perf-testcases/test-reg-readwrite-object.rb @@ -0,0 +1,130 @@ +def test() + a = Hash[]; b = Hash[]; c = Hash[]; d = Hash[] + + i = 0 + while i < 1e6 do + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + i += 1 + end +end + +test() diff --git a/perf-testcases/test-reg-readwrite-plain.js b/perf-testcases/test-reg-readwrite-plain.js new file mode 100644 index 00000000..03173337 --- /dev/null +++ b/perf-testcases/test-reg-readwrite-plain.js @@ -0,0 +1,139 @@ +/* + * Test bytecode register assignments with plain values. Involves only + * a dispatch and a tval copy for a non-heap-allocated tval. + */ + +function test() { + var a, b, c, d; + var i; + + a = 1; b = 2; c = 3; d = 4; + + for (i = 0; i < 1e6; i++) { + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + + // 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b; + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); +} diff --git a/perf-testcases/test-reg-readwrite-plain.lua b/perf-testcases/test-reg-readwrite-plain.lua new file mode 100644 index 00000000..405a82fc --- /dev/null +++ b/perf-testcases/test-reg-readwrite-plain.lua @@ -0,0 +1,132 @@ +function test() + local a, b, c, d, i; + + a = 1 + b = 2 + c = 3 + d = 4 + + for i=1,1e6 do + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + -- 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + end +end + +test() diff --git a/perf-testcases/test-reg-readwrite-plain.pl b/perf-testcases/test-reg-readwrite-plain.pl new file mode 100644 index 00000000..f39d8b44 --- /dev/null +++ b/perf-testcases/test-reg-readwrite-plain.pl @@ -0,0 +1,130 @@ +sub test { + my $a, $b, $c, $d; + my $i; + + $a = 1; $b = 2; $c = 3; $d = 4; + + for ($i = 0; $i < 1e6; $i++) { + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + + # 100 + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + $a = $a; $a = $b; $a = $c; $a = $d; $b = $a; $b = $b; $b = $c; $b = $d; $c = $a; $c = $b; + } +} + +test(); diff --git a/perf-testcases/test-reg-readwrite-plain.py b/perf-testcases/test-reg-readwrite-plain.py new file mode 100644 index 00000000..d98dc1dd --- /dev/null +++ b/perf-testcases/test-reg-readwrite-plain.py @@ -0,0 +1,131 @@ +def test(): + a = 1 + b = 2 + c = 3 + d = 4 + + i = 0 + while i < 1e6: + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + i += 1 + +test() diff --git a/perf-testcases/test-reg-readwrite-plain.rb b/perf-testcases/test-reg-readwrite-plain.rb new file mode 100644 index 00000000..e418d9b1 --- /dev/null +++ b/perf-testcases/test-reg-readwrite-plain.rb @@ -0,0 +1,130 @@ +def test() + a = 1; b = 2; c = 3; d = 4 + + i = 0 + while i < 1e6 do + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + # 100 + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b + + i += 1 + end +end + +test() From d2dd31ac29d8b3dbeb1ce22ef0cd1c7d6b8f5bb8 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Sat, 10 Jan 2015 03:53:34 +0200 Subject: [PATCH 2/2] Makefile targets for quick-and-dirty perf tests --- Makefile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Makefile b/Makefile index 9a74914a..8b9555aa 100644 --- a/Makefile +++ b/Makefile @@ -1023,3 +1023,31 @@ massif-%: ecmascript-testcases/%.js duk massif-helloworld: massif-test-dev-hello-world massif-deepmerge: massif-test-dev-deepmerge massif-arcfour: massif-test-dev-arcfour + +# Perf test placeholder, quite inaccurate, simply based on "time". +# - Duktape is interpreted and uses reference counting +# - Python and Perl are interpreted and also use reference counting +# - Ruby and Lua are interpreted but don't use reference counting +# - Rhino compiles to Java bytecode and is ultimately JITed +perftest: duk + for i in perf-testcases/*.js; do echo \ + "`basename $$i`:" \ + "duk `time -f %U -o /tmp/time --quiet ./duk $$i >/dev/null 2>&1; cat /tmp/time; rm /tmp/time`" \ + "rhino `time -f %U -o /tmp/time --quiet rhino $$i >/dev/null 2>&1; cat /tmp/time; rm /tmp/time`" \ + "lua `time -f %U -o /tmp/time --quiet lua $${i%%.js}.lua >/dev/null 2>&1; cat /tmp/time; rm /tmp/time`" \ + "python `time -f %U -o /tmp/time --quiet python $${i%%.js}.py >/dev/null 2>&1; cat /tmp/time; rm /tmp/time`" \ + "perl `time -f %U -o /tmp/time --quiet perl $${i%%.js}.pl >/dev/null 2>&1; cat /tmp/time; rm /tmp/time`" \ + "ruby `time -f %U -o /tmp/time --quiet ruby $${i%%.js}.rb >/dev/null 2>&1; cat /tmp/time; rm /tmp/time`"; \ + done +perftestduk: duk + for i in perf-testcases/*.js; do echo \ + "`basename $$i`:" \ + "duk `time -f %U -o /tmp/time ./duk $$i >/dev/null 2>&1; cat /tmp/time; rm /tmp/time`"; \ + done +perftestduk3: duk + for i in perf-testcases/*.js; do echo \ + "`basename $$i`: duk" \ + "`time -f %U -o /tmp/time ./duk $$i >/dev/null 2>&1; cat /tmp/time; rm /tmp/time`" \ + "`time -f %U -o /tmp/time ./duk $$i >/dev/null 2>&1; cat /tmp/time; rm /tmp/time`" \ + "`time -f %U -o /tmp/time ./duk $$i >/dev/null 2>&1; cat /tmp/time; rm /tmp/time`"; \ + done