From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/benchmark/other-lang/ack.pl | 11 ++++++ jni/ruby/benchmark/other-lang/ack.py | 16 +++++++++ jni/ruby/benchmark/other-lang/ack.rb | 12 +++++++ jni/ruby/benchmark/other-lang/ack.scm | 7 ++++ jni/ruby/benchmark/other-lang/eval.rb | 66 ++++++++++++++++++++++++++++++++++ jni/ruby/benchmark/other-lang/fact.pl | 13 +++++++ jni/ruby/benchmark/other-lang/fact.py | 18 ++++++++++ jni/ruby/benchmark/other-lang/fact.rb | 13 +++++++ jni/ruby/benchmark/other-lang/fact.scm | 8 +++++ jni/ruby/benchmark/other-lang/fib.pl | 11 ++++++ jni/ruby/benchmark/other-lang/fib.py | 7 ++++ jni/ruby/benchmark/other-lang/fib.rb | 9 +++++ jni/ruby/benchmark/other-lang/fib.scm | 7 ++++ jni/ruby/benchmark/other-lang/loop.pl | 3 ++ jni/ruby/benchmark/other-lang/loop.py | 2 ++ jni/ruby/benchmark/other-lang/loop.rb | 4 +++ jni/ruby/benchmark/other-lang/loop.scm | 1 + jni/ruby/benchmark/other-lang/loop2.rb | 1 + jni/ruby/benchmark/other-lang/tak.pl | 11 ++++++ jni/ruby/benchmark/other-lang/tak.py | 8 +++++ jni/ruby/benchmark/other-lang/tak.rb | 13 +++++++ jni/ruby/benchmark/other-lang/tak.scm | 10 ++++++ 22 files changed, 251 insertions(+) create mode 100644 jni/ruby/benchmark/other-lang/ack.pl create mode 100644 jni/ruby/benchmark/other-lang/ack.py create mode 100644 jni/ruby/benchmark/other-lang/ack.rb create mode 100644 jni/ruby/benchmark/other-lang/ack.scm create mode 100644 jni/ruby/benchmark/other-lang/eval.rb create mode 100644 jni/ruby/benchmark/other-lang/fact.pl create mode 100644 jni/ruby/benchmark/other-lang/fact.py create mode 100644 jni/ruby/benchmark/other-lang/fact.rb create mode 100644 jni/ruby/benchmark/other-lang/fact.scm create mode 100644 jni/ruby/benchmark/other-lang/fib.pl create mode 100644 jni/ruby/benchmark/other-lang/fib.py create mode 100644 jni/ruby/benchmark/other-lang/fib.rb create mode 100644 jni/ruby/benchmark/other-lang/fib.scm create mode 100644 jni/ruby/benchmark/other-lang/loop.pl create mode 100644 jni/ruby/benchmark/other-lang/loop.py create mode 100644 jni/ruby/benchmark/other-lang/loop.rb create mode 100644 jni/ruby/benchmark/other-lang/loop.scm create mode 100644 jni/ruby/benchmark/other-lang/loop2.rb create mode 100644 jni/ruby/benchmark/other-lang/tak.pl create mode 100644 jni/ruby/benchmark/other-lang/tak.py create mode 100644 jni/ruby/benchmark/other-lang/tak.rb create mode 100644 jni/ruby/benchmark/other-lang/tak.scm (limited to 'jni/ruby/benchmark/other-lang') diff --git a/jni/ruby/benchmark/other-lang/ack.pl b/jni/ruby/benchmark/other-lang/ack.pl new file mode 100644 index 0000000..201e22d --- /dev/null +++ b/jni/ruby/benchmark/other-lang/ack.pl @@ -0,0 +1,11 @@ +use integer; + +sub Ack { + return $_[0] ? ($_[1] ? Ack($_[0]-1, Ack($_[0], $_[1]-1)) + : Ack($_[0]-1, 1)) + : $_[1]+1; +} + +my $NUM = 9; +$NUM = 1 if ($NUM < 1); +my $ack = Ack(3, $NUM); diff --git a/jni/ruby/benchmark/other-lang/ack.py b/jni/ruby/benchmark/other-lang/ack.py new file mode 100644 index 0000000..9968e7c --- /dev/null +++ b/jni/ruby/benchmark/other-lang/ack.py @@ -0,0 +1,16 @@ +import sys +sys.setrecursionlimit(5000000) + +def Ack(M, N): + if (not M): + return( N + 1 ) + if (not N): + return( Ack(M-1, 1) ) + return( Ack(M-1, Ack(M, N-1)) ) + +def main(): + NUM = 9 + sys.setrecursionlimit(10000) + Ack(3, NUM) + +main() diff --git a/jni/ruby/benchmark/other-lang/ack.rb b/jni/ruby/benchmark/other-lang/ack.rb new file mode 100644 index 0000000..7451bed --- /dev/null +++ b/jni/ruby/benchmark/other-lang/ack.rb @@ -0,0 +1,12 @@ +def ack(m, n) + if m == 0 then + n + 1 + elsif n == 0 then + ack(m - 1, 1) + else + ack(m - 1, ack(m, n - 1)) + end +end + +NUM = 9 +ack(3, NUM) diff --git a/jni/ruby/benchmark/other-lang/ack.scm b/jni/ruby/benchmark/other-lang/ack.scm new file mode 100644 index 0000000..a80b73b --- /dev/null +++ b/jni/ruby/benchmark/other-lang/ack.scm @@ -0,0 +1,7 @@ +(define (ack m n) + (cond ((zero? m) (+ n 1)) + ((zero? n) (ack (- m 1) 1)) + (else (ack (- m 1) (ack m (- n 1)))))) + +(ack 3 9) + diff --git a/jni/ruby/benchmark/other-lang/eval.rb b/jni/ruby/benchmark/other-lang/eval.rb new file mode 100644 index 0000000..48a2cea --- /dev/null +++ b/jni/ruby/benchmark/other-lang/eval.rb @@ -0,0 +1,66 @@ + +Bench = %w( + loop + ack + fib + tak + fact +) + +Lang = <