From 02a84743ddf5c8c27a36c4d5a20eaf3cd2a9aff4 Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Sun, 28 Aug 2022 20:40:57 +0900 Subject: Update for n-queens --- comparison/Haskell/Makefile | 7 +- comparison/Haskell/fib-38.hs | 6 ++ comparison/Haskell/nqueen-12.hs | 21 +++++ comparison/Inpla/main.sh | 9 ++ comparison/Inpla/src/nqueen-12-reuse.in | 141 ++++++++++++++++++++++++++++++++ comparison/Inpla/src/nqueen-12.in | 141 ++++++++++++++++++++++++++++++++ comparison/OCaml/Makefile | 5 +- comparison/OCaml/nqueen12.ml | 23 ++++++ comparison/Python/Makefile | 2 +- comparison/Python/fib-38.py | 8 ++ comparison/Python/nqueen-12.py | 27 ++++++ comparison/SML/Makefile | 2 +- comparison/SML/fib-38.sml | 5 ++ comparison/SML/nqueen-12.sml | 33 ++++++++ 14 files changed, 425 insertions(+), 5 deletions(-) create mode 100644 comparison/Haskell/fib-38.hs create mode 100644 comparison/Haskell/nqueen-12.hs create mode 100644 comparison/Inpla/src/nqueen-12-reuse.in create mode 100644 comparison/Inpla/src/nqueen-12.in create mode 100644 comparison/OCaml/nqueen12.ml create mode 100644 comparison/Python/fib-38.py create mode 100644 comparison/Python/nqueen-12.py create mode 100644 comparison/SML/fib-38.sml create mode 100644 comparison/SML/nqueen-12.sml diff --git a/comparison/Haskell/Makefile b/comparison/Haskell/Makefile index 13a1b83..ee4e347 100644 --- a/comparison/Haskell/Makefile +++ b/comparison/Haskell/Makefile @@ -1,7 +1,7 @@ CC = stack ghc CFLAGS = -O2 BENCHMARK = bash ../tools/sptest_commands.sh -TARGET = ack3-11 fib38 bsort-20000 isort-20000 qsort-260000 msort-260000 +TARGET = nqueen-12 ack3-11 fib-38 bsort-20000 isort-20000 qsort-260000 msort-260000 LOG = log.txt @@ -12,10 +12,13 @@ all: $(LOG) $(LOG): $(TARGET) $(BENCHMARK) $(TARGET) +nqueen-12: nqueen-12.hs + $(CC) -- $(CFLAGS) $< + ack3-11: ack3-11.hs $(CC) -- $(CFLAGS) $< -fib38: fib38.hs +fib-38: fib-38.hs $(CC) -- $(CFLAGS) $< bsort-20000: bsort-20000.hs diff --git a/comparison/Haskell/fib-38.hs b/comparison/Haskell/fib-38.hs new file mode 100644 index 0000000..658d228 --- /dev/null +++ b/comparison/Haskell/fib-38.hs @@ -0,0 +1,6 @@ +fib 0 = 0 +fib 1 = 1 +fib n = fib (n - 2) + fib (n - 1) + + +main = print $ fib 38 diff --git a/comparison/Haskell/nqueen-12.hs b/comparison/Haskell/nqueen-12.hs new file mode 100644 index 0000000..1efb57b --- /dev/null +++ b/comparison/Haskell/nqueen-12.hs @@ -0,0 +1,21 @@ +member x [] = False +member x (y:ys) + | x==y = True + | otherwise = member x ys + +threat k m [] = False +threat k m (x:xs) + | (k == x-m) || (k == m-x) = True + | otherwise = threat (k+1) m xs + + +queen1 0 b n = [] +queen1 m b n + | (member m b) || (threat 1 m b) = (queen1 (m-1) b n) + | (length b) == (n-1) = [m:b] ++ (queen1 (m-1) b n) + | otherwise = (queen1 n (m:b) n) ++ (queen1 (m-1) b n) + +queen n = queen1 n [] n + +n=12 +main = print $ (length (queen n)) diff --git a/comparison/Inpla/main.sh b/comparison/Inpla/main.sh index 13502b9..c3ba3b3 100644 --- a/comparison/Inpla/main.sh +++ b/comparison/Inpla/main.sh @@ -1,5 +1,8 @@ #!/bin/bash +bash ./sptestInpla.sh src/nqueen-12.in '-Xmt 6' +bash ./sptestInpla.sh src/nqueen-12-reuse.in '-Xmt 6' + bash ./sptestInpla.sh src/fib-38.in bash ./sptestInpla.sh src/fib-38-reuse.in @@ -17,3 +20,9 @@ bash ./sptestInpla.sh src/qsort-260000-reuse.in '-Xms 17 -Xmt 0' bash ./sptestInpla.sh src/msort-260000.in bash ./sptestInpla.sh src/msort-260000-reuse.in '-Xms 18 -Xmt 0' + +bash ./sptestInpla.sh src/qsort-800000.in +bash ./sptestInpla.sh src/qsort-800000-reuse.in '-Xms 18 -Xmt 0' + +bash ./sptestInpla.sh src/msort-800000.in +bash ./sptestInpla.sh src/msort-800000-reuse.in '-Xms 18 -Xmt 0' diff --git a/comparison/Inpla/src/nqueen-12-reuse.in b/comparison/Inpla/src/nqueen-12-reuse.in new file mode 100644 index 0000000..4e5a6b6 --- /dev/null +++ b/comparison/Inpla/src/nqueen-12-reuse.in @@ -0,0 +1,141 @@ +// N-Queen +// +// The original is written as a Lisp program in the following file: +// https://www.istc.kobe-u.ac.jp/activity/mage/m27/27_Lisp.pdf + + +/** + * member + * r, done << member(m, list) + * return + * r: 1 if m occurs in list + * done: the same to `list' + */ +// fun member x [] = false +// | member x (y::ys) = if x=y then true else (member x ys); + +member(r, list, int x) >< [] => + r~0, list~(*R)[]; +member(r, list, int x) >< (int y):ys +| x==y => + r~1, list~(*R)(y:ys) +| _ => + list~(*R)(y:cnt), member(r, cnt, x)~ys; + + +/** + * len_list (stream version) + * len, done << len_list(list) + * return + * len: length of `list' + * done: the same to `list' + */ + +len_list(len, done) >< [] => + len~0, done~(*R)[]; +len_list(len, done) >< x:xs => + done~(*R)(x:cnt), + len_list_(len, cnt, 1)~xs; + +len_list_(len, done, int ct) >< [] => + len~ct, done~(*R)[]; +len_list_(len, done, int ct) >< x:xs => + done~(*R)(x:cnt), + len_list_(len, cnt, ct+1) ~ xs; + +/** + * len (non-stream version) + * ret << len(list) + * return + * ret: length of `list' + */ + +len(ret) >< [] => + ret~0; +len(ret) >< x:xs => + len_list(ret, Eraser)~(*R)(x:xs); + + + +/** + * threat (stream version) + * check for (0,q) and (k, qpos[col=k]) where k=1... + * http://www.nct9.ne.jp/m_hiroi/func/haskell06.html + 0 1 2 --> + +------------- + 1| . . . . . . + 2| . . . -3. . 5 - 3 = 2 + 3| . . -2. . . 5 - 2 = 3 + 4| . -1. . . . 5 - 1 = 4 + 5| Q . . . . . Q position is 5 + 6| . +1. . . . 5 + 1 = 6 + 7| . . +2. . . 5 + 2 = 7 + 8| . . . +3. . 5 + 2 = 8 + +------------- + * r, done << threat(k,m, board) + * return + * r: 1 if threat conditions are satisfied + * done: the same to `board' + */ +// fun threat k m [] = false +// | threat k m (x::xs) = +// if (k = x-m) orelse (k = x+m) then true +// else (threat (k+1) m xs); + +threat(r, done, int k, int q)><[] => + r~0, done~(*R)[]; +threat(r, done, int k, int q)><(int x):xs +| (k == x-q) or (k == q-x) => + r~1, done~(*R)(x:xs) +| _ => + done~(*R)(x:cnt), threat(r, cnt, k+1, q)~xs; + + + +// fun queen1 b n 0 = [] +// | queen1 b n m = +// if (member m b) orelse (threat 1 m b) then (queen1 b n (m-1)) +// else if (length b) = (n-1) then (m::b)::(queen1 b n (m-1)) +// else (queen1 (m::b) n n) @ (queen1 b n (m-1)); +// fun queen n = queen1 n [] n; + +queen(ret) >< (int n) => queen_(ret, [], n)~n; + +queen_(r, b, int n) >< (int m) +| m==0 => + r~[], (*L)Eraser~b +| _ => + mem_ret, done_b << member(m,b), + queen__chk_m_in_b(r, done_b, n, m)~mem_ret; + +queen__chk_m_in_b(r, b, int n, int m) >< (int mem_ret) +| mem_ret == 1 => + (*L)queen_(r, b, n)~(m-1) +| _ => + th_ret, done_b << threat(1, m, b), + (*L)queen__chk_threat(r, done_b, n, m)~th_ret; + +queen__chk_threat(r, b, int n, int m) >< (int threat_ret) +| threat_ret == 1 => + (*L)queen_(r, b, n)~(m-1) +| _ => + len_ret, done_b << len_list(b), + (*L)queen__chk_lastelem(r, done_b, n, m)~len_ret; + +queen__chk_lastelem(r, b, int n, int m) >< (int len_ret) +| len_ret == n-1 => + b1, b2 << Dup(b), + r~(m:b1):cnt, (*L)queen_(cnt, b2, n)~(m-1) +| _ => + b1, b2 << Dup(b), + r << Append(cnt1, cnt2), + (*L)queen_(cnt1, m:b1, n)~n, queen_(cnt2, b2, n)~(m-1); + + + +// ---------------------------------------------------------- +// main +// ---------------------------------------------------------- +const N=12; +queen(ret)~N, len(count)~ret; +count; // count ->14200 diff --git a/comparison/Inpla/src/nqueen-12.in b/comparison/Inpla/src/nqueen-12.in new file mode 100644 index 0000000..18f3a64 --- /dev/null +++ b/comparison/Inpla/src/nqueen-12.in @@ -0,0 +1,141 @@ +// N-Queen +// +// The original is written as a Lisp program in the following file: +// https://www.istc.kobe-u.ac.jp/activity/mage/m27/27_Lisp.pdf + + +/** + * member + * r, done << member(m, list) + * return + * r: 1 if m occurs in list + * done: the same to `list' + */ +// fun member x [] = false +// | member x (y::ys) = if x=y then true else (member x ys); + +member(r, list, int x) >< [] => + r~0, list~[]; +member(r, list, int x) >< (int y):ys +| x==y => + r~1, list~y:ys +| _ => + list~y:cnt, member(r, cnt, x)~ys; + + +/** + * len_list (stream version) + * len, done << len_list(list) + * return + * len: length of `list' + * done: the same to `list' + */ + +len_list(len, done) >< [] => + len~0, done~[]; +len_list(len, done) >< x:xs => + done~x:cnt, + len_list_(len, cnt, 1)~xs; + +len_list_(len, done, int ct) >< [] => + len~ct, done~[]; +len_list_(len, done, int ct) >< x:xs => + done~x:cnt, + len_list_(len, cnt, ct+1) ~ xs; + +/** + * len (non-stream version) + * ret << len(list) + * return + * ret: length of `list' + */ + +len(ret) >< [] => + ret~0; +len(ret) >< x:xs => + len_list(ret, Eraser)~x:xs; + + + +/** + * threat (stream version) + * check for (0,q) and (k, qpos[col=k]) where k=1... + * http://www.nct9.ne.jp/m_hiroi/func/haskell06.html + 0 1 2 --> + +------------- + 1| . . . . . . + 2| . . . -3. . 5 - 3 = 2 + 3| . . -2. . . 5 - 2 = 3 + 4| . -1. . . . 5 - 1 = 4 + 5| Q . . . . . Q position is 5 + 6| . +1. . . . 5 + 1 = 6 + 7| . . +2. . . 5 + 2 = 7 + 8| . . . +3. . 5 + 2 = 8 + +------------- + * r, done << threat(k,m, board) + * return + * r: 1 if threat conditions are satisfied + * done: the same to `board' + */ +// fun threat k m [] = false +// | threat k m (x::xs) = +// if (k = x-m) orelse (k = x+m) then true +// else (threat (k+1) m xs); + +threat(r, done, int k, int q)><[] => + r~0, done~[]; +threat(r, done, int k, int q)><(int x):xs +| (k == x-q) or (k == q-x) => + r~1, done~(x:xs) +| _ => + done~x:cnt, threat(r, cnt, k+1, q)~xs; + + + +// fun queen1 b n 0 = [] +// | queen1 b n m = +// if (member m b) orelse (threat 1 m b) then (queen1 b n (m-1)) +// else if (length b) = (n-1) then (m::b)::(queen1 b n (m-1)) +// else (queen1 (m::b) n n) @ (queen1 b n (m-1)); +// fun queen n = queen1 n [] n; + +queen(ret) >< (int n) => queen_(ret, [], n)~n; + +queen_(r, b, int n) >< (int m) +| m==0 => + r~[], Eraser~b +| _ => + mem_ret, done_b << member(m,b), + queen__chk_m_in_b(r, done_b, n, m)~mem_ret; + +queen__chk_m_in_b(r, b, int n, int m) >< (int mem_ret) +| mem_ret == 1 => + queen_(r, b, n)~(m-1) +| _ => + th_ret, done_b << threat(1, m, b), + queen__chk_threat(r, done_b, n, m)~th_ret; + +queen__chk_threat(r, b, int n, int m) >< (int threat_ret) +| threat_ret == 1 => + queen_(r, b, n)~(m-1) +| _ => + len_ret, done_b << len_list(b), + queen__chk_lastelem(r, done_b, n, m)~len_ret; + +queen__chk_lastelem(r, b, int n, int m) >< (int len_ret) +| len_ret == n-1 => + b1, b2 << Dup(b), + r~(m:b1):cnt, queen_(cnt, b2, n)~(m-1) +| _ => + b1, b2 << Dup(b), + r << Append(cnt1, cnt2), + queen_(cnt1, m:b1, n)~n, queen_(cnt2, b2, n)~(m-1); + + + +// ---------------------------------------------------------- +// main +// ---------------------------------------------------------- +const N=12; +queen(ret)~N, len(count)~ret; +count; // count ->14200 diff --git a/comparison/OCaml/Makefile b/comparison/OCaml/Makefile index 9db7726..18c1eda 100644 --- a/comparison/OCaml/Makefile +++ b/comparison/OCaml/Makefile @@ -1,7 +1,7 @@ CC = ocamlopt CFLAGS = BENCHMARK = bash ../tools/sptest_commands.sh -TARGET = ack3_11 fib38 bsort20000 isort20000 qsort260000 msort260000 +TARGET = nqueen12 ack3_11 fib38 bsort20000 isort20000 qsort260000 msort260000 LOG = log.txt @@ -12,6 +12,9 @@ all: $(LOG) $(LOG): $(TARGET) $(BENCHMARK) $(TARGET) +nqueen12: nqueen12.ml + $(CC) $(CFLAGS) $< -o $@ + ack3_11: ack3_11.ml $(CC) $(CFLAGS) $< -o $@ diff --git a/comparison/OCaml/nqueen12.ml b/comparison/OCaml/nqueen12.ml new file mode 100644 index 0000000..fc56542 --- /dev/null +++ b/comparison/OCaml/nqueen12.ml @@ -0,0 +1,23 @@ +let rec member x alist = + match alist with + [] -> false + | y::ys -> if x=y then true else (member x ys);; + +let rec threat k m alist = + match alist with + [] -> false + | x::xs -> if (k = x-m) || (k = m-x) then true + else (threat (k+1) m xs);; + +let rec queen1 m b n = + match m with + 0 -> [] + | m -> + if (member m b) || (threat 1 m b) then (queen1 (m-1) b n) + else if (List.length b) = (n-1) then [m::b]@(queen1 (m-1) b n) + else (queen1 n (m::b) n) @ (queen1 (m-1) b n);; + +let queen n = queen1 n [] n;; + +let n = 12;; +let () = print_int (List.length (queen n)); diff --git a/comparison/Python/Makefile b/comparison/Python/Makefile index c77d677..5dd95fd 100644 --- a/comparison/Python/Makefile +++ b/comparison/Python/Makefile @@ -1,5 +1,5 @@ COMMAND = python3 -TARGET = dummy.py ack3-11.py fib38.py bsort-20000.py isort-20000.py qsort-260000.py msort-260000.py +TARGET = dummy.py nqueen-12.py ack3-11.py fib-38.py bsort-20000.py isort-20000.py qsort-260000.py msort-260000.py BENCHMARK = bash ../tools/sptest_scripts.sh LOG = log.txt diff --git a/comparison/Python/fib-38.py b/comparison/Python/fib-38.py new file mode 100644 index 0000000..efa5380 --- /dev/null +++ b/comparison/Python/fib-38.py @@ -0,0 +1,8 @@ +def fib(n): + if n == 0: + return 0 + elif n == 1: + return 1 + else: + return fib(n-1) + fib(n-2) +print(fib(38)) diff --git a/comparison/Python/nqueen-12.py b/comparison/Python/nqueen-12.py new file mode 100644 index 0000000..494131f --- /dev/null +++ b/comparison/Python/nqueen-12.py @@ -0,0 +1,27 @@ +def threat(k, m, alist): + if alist == []: + return False + else: + x = alist[0] + if (k == x-m) or (k == m-x): + return True + else: + return threat(k+1, m, alist[1:]) + +def queen1(m, b, n): + if m == 0: + return [] + else: + if (m in b) or threat(1, m, b): + return queen1(m-1, b, n) + elif len(b) == n-1: + return [[m]+b] + (queen1(m-1, b, n)) + else: + return queen1(n, [m]+b, n) + (queen1(m-1, b, n)) + + +def queen(n): + return queen1(n,[],n) + +n=12 +print(len(queen(12))) diff --git a/comparison/SML/Makefile b/comparison/SML/Makefile index 14dca02..5e89840 100644 --- a/comparison/SML/Makefile +++ b/comparison/SML/Makefile @@ -1,5 +1,5 @@ COMMAND = sml -TARGET = dummy.sml ack3-11.sml fib38.sml bsort-20000.sml isort-20000.sml qsort-260000.sml msort-260000.sml +TARGET = dummy.sml nqueen-12.sml ack3-11.sml fib-38.sml bsort-20000.sml isort-20000.sml qsort-260000.sml msort-260000.sml BENCHMARK = bash ../tools/sptest_scripts.sh LOG = log.txt diff --git a/comparison/SML/fib-38.sml b/comparison/SML/fib-38.sml new file mode 100644 index 0000000..504d4ac --- /dev/null +++ b/comparison/SML/fib-38.sml @@ -0,0 +1,5 @@ +fun fib 0 = 0 +| fib 1 = 1 +| fib n = (fib (n-1)) + (fib (n-2)); + +fib 38; diff --git a/comparison/SML/nqueen-12.sml b/comparison/SML/nqueen-12.sml new file mode 100644 index 0000000..9605312 --- /dev/null +++ b/comparison/SML/nqueen-12.sml @@ -0,0 +1,33 @@ +fun member x [] = false +| member x (y::ys) = if x=y then true else (member x ys); + +(* check for (0,q) and (k, qpos[col=k]) where k=1... +http://www.nct9.ne.jp/m_hiroi/func/haskell06.html + 0 1 2 --> + *------------- + 1| . . . . . . + 2| . . . -3. . 5 - 3 = 2 + 3| . . -2. . . 5 - 2 = 3 + 4| . -1. . . . 5 - 1 = 4 + 5| Q . . . . . Q position is 5 + 6| . +1. . . . 5 + 1 = 6 + 7| . . +2. . . 5 + 2 = 7 + 8| . . . +3. . 5 + 2 = 8 + *------------- +*) +fun threat k m [] = false + | threat k m (x::xs) = + if (k = x-m) orelse (k = m-x) then true + else (threat (k+1) m xs); + + +fun queen1 0 b n = [] + | queen1 m b n = + if (member m b) orelse (threat 1 m b) then (queen1 (m-1) b n) + else if (length b) = (n-1) then [m::b]@(queen1 (m-1) b n) + else (queen1 n (m::b) n) @ (queen1 (m-1) b n); + +fun queen n = queen1 n [] n; + +val n = 12; +length (queen n); -- cgit v1.2.3 From b850b9d9e64c12a927bfc2692b4134b23ef79be5 Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Sun, 28 Aug 2022 20:42:08 +0900 Subject: Update the speed-up ratio graph --- README.md | 27 ++++++++++++++------------- pic/benchmark_reuse_v0.9.2-3.png | Bin 0 -> 38717 bytes 2 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 pic/benchmark_reuse_v0.9.2-3.png diff --git a/README.md b/README.md index 623af17..81b718e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Inpla is a multi-threaded parallel interpreter of interaction nets. Once you wri * The current version is 0.9.2-3 (bugfix mainly), released on **22 August 2022**. (See [Changelog.md](Changelog.md) for details.) * The below graph shows speed-up ratio to threads numbers for programs in the following benchmark table. -![speedup-ratio](pic/benchmark_reuse_v0.8.2-2.png) +![speedup-ratio](pic/benchmark_reuse_v0.9.2-3.png) - **Comparison in execution time** with other implementations: **Haskell** (GHC version 8.10.7), **OCaml** (ocamlopt, the native-code compiler, version 4.08.1), **Standard ML of New Jersey** v110.74 (interpreter mode) and **Python** 3.8.5 in execution time. @@ -17,14 +17,13 @@ Inpla is a multi-threaded parallel interpreter of interaction nets. Once you wri | | Haskell | OCaml | SML | Python | Inpla8 | Inpla8r | | -------------- | :------: | :------: | :----: | :----: | :------: | :------: | -| ack(3,11) | [2.30](comparison/Haskell/ack3-11.hs) | [0.46](comparison/OCaml/ack3_11.ml) | [**0.43**](comparison/SML/ack3-11.sml) | [-](comparison/Python/ack3-11.py) | [0.86](comparison/Inpla/src/ack-stream_3-11.in) | [0.71](comparison/Inpla/src/ack-stream_3-11-reuse.in) | -| fib 38 | [1.60](comparison/Haskell/fib38.hs) | [**0.15**](comparison/OCaml/fib38.ml) | [0.27](comparison/SML/fib38.sml) | [8.88](comparison/Python/fib38.py) | [0.40](comparison/Inpla/src/fib-38.in) | [0.43](comparison/Inpla/src/fib-38-reuse.in) | -| bsort 20000 | [4.98](comparison/Haskell/bsort-40000.hs) | [6.78](comparison/OCaml/bsort40000.ml) | [2.38](comparison/SML/bsort-40000.sml) | [19.91](comparison/Python/bsort-40000.py) | [2.16](comparison/Inpla/src/bsort-20000.in) | [**1.58**](comparison/Inpla/src/bsort-20000-reuse.in) | -| isort 20000 | [2.15](comparison/Haskell/isort-40000.hs) | [1.52](comparison/OCaml/isort40000.ml) | [0.60](comparison/SML/isort-40000.sml) | [9.58](comparison/Python/isort-40000.py) | [**0.29**](comparison/Inpla/src/isort-40000.in) | [0.33](comparison/Inpla/src/isort-40000-reuse.in) | -| qsort 260000 | [0.34](comparison/Haskell/qsort-800000.hs) | [0.25](comparison/OCaml/qsort800000.ml) | [0.27](comparison/SML/qsort-800000.sml) | [10.40](comparison/Python/qsort-800000.py) | [0.15](comparison/Inpla/src/qsort-800000.in) | [**0.11**](comparison/Inpla/src/qsort-800000-reuse.in) | -| msort 260000 | [0.39](comparison/Haskell/msort-800000.hs) | [0.29](comparison/OCaml/msort800000.ml) | [0.26](comparison/SML/msort-800000.sml) | [10.96](comparison/Python/msort-800000.py) | [**0.15**](comparison/Inpla/src/msort-800000.in) | [**0.15**](comparison/Inpla/src/msort-800000-reuse.in) | - - +| n-queens 12 | [**0.23**](comparison/Haskell/nqueen-12.hs) | [0.44](comparison/OCaml/nqueen12.ml) | [0.60](comparison/SML/ack3-11.sml) | [3.85](comparison/Python/nqueen-12.py) | [0.53](comparison/Inpla/src/nqueen-12.in) | [0.36](comparison/Inpla/src/nqueen-12-reuse.in) | +| ack(3,11) | [2.36](comparison/Haskell/ack3-11.hs) | [0.57](comparison/OCaml/ack3_11.ml) | [**0.41**](comparison/SML/ack3-11.sml) | [-](comparison/Python/ack3-11.py) | [0.90](comparison/Inpla/src/ack-stream_3-11.in) | [0.71](comparison/Inpla/src/ack-stream_3-11-reuse.in) | +| fib 38 | [1.61](comparison/Haskell/fib-38.hs) | [**0.15**](comparison/OCaml/fib38.ml) | [0.27](comparison/SML/fib-38.sml) | [9.03](comparison/Python/fib-38.py) | [0.42](comparison/Inpla/src/fib-38.in) | [0.46](comparison/Inpla/src/fib-38-reuse.in) | +| bsort 20000 | [4.98](comparison/Haskell/bsort-20000.hs) | [6.44](comparison/OCaml/bsort20000.ml) | [2.38](comparison/SML/bsort-20000.sml) | [20.64](comparison/Python/bsort-20000.py) | [2.26](comparison/Inpla/src/bsort-20000.in) | [**1.60**](comparison/Inpla/src/bsort-20000-reuse.in) | +| isort 20000 | [2.18](comparison/Haskell/isort-20000.hs) | [1.48](comparison/OCaml/isort20000.ml) | [0.59](comparison/SML/isort-20000.sml) | [9.20](comparison/Python/isort-20000.py) | [**0.30**](comparison/Inpla/src/isort-20000.in) | [0.34](comparison/Inpla/src/isort-20000-reuse.in) | +| qsort 260000 | [0.32](comparison/Haskell/qsort-800000.hs) | [0.22](comparison/OCaml/qsort260000.ml) | [0.27](comparison/SML/qsort-260000.sml) | [15.03](comparison/Python/qsort-260000.py) | [0.15](comparison/Inpla/src/qsort-260000.in) | [**0.12**](comparison/Inpla/src/qsort-260000-reuse.in) | +| msort 260000 | [0.38](comparison/Haskell/msort-800000.hs) | [0.17](comparison/OCaml/msort260000.ml) | [0.28](comparison/SML/msort-260000.sml) | [15.57](comparison/Python/msort-260000.py) | [**0.15**](comparison/Inpla/src/msort-260000.in) | [**0.15**](comparison/Inpla/src/msort-260000-reuse.in) | @@ -32,6 +31,8 @@ Inpla is a multi-threaded parallel interpreter of interaction nets. Once you wri - Inpla8 and Inpla8r mean 8 threads without/with [reuse-annotated](./Gentle_introduction_Inpla.md#reuse-annotations) execution, respectively. + - "n-queens 12" is computation of n-Queens at 12. + - "ack(3,11)" is computation of Ackermann function. Execution time of Python is a blank due to stack size limitation error. - "fib 38" is computation to get the 38th Fibonacci number. @@ -80,7 +81,7 @@ Inpla is a multi-threaded parallel interpreter of interaction nets. Once you wri ``` $ ./inpla - Inpla 0.8.0 : Interaction nets as a programming language [built: 27 Feb. 2022] + Inpla 0.9.2-3 : Interaction nets as a programming language [built: 22 August 2022] >>> ``` @@ -137,7 +138,7 @@ Inpla is a multi-threaded parallel interpreter of interaction nets. Once you wri ``` $ ./inpla -f sample/gcd.in - Inpla 0.8.0 : Interaction nets as a programming language [built: 27 Feb. 2022] + Inpla 0.9.2-3 : Interaction nets as a programming language [built: 22 August 2022] (4 interactions, 0.00 sec) 7 @@ -170,7 +171,7 @@ Inpla is a multi-threaded parallel interpreter of interaction nets. Once you wri ``` $ ./inpla -f sample/isort.in - Inpla 0.8.0 : Interaction nets as a programming language [built: 27 Feb. 2022] + Inpla 0.9.2-3 : Interaction nets as a programming language [built: 22 August 2022] (16 interactions, 0.00 sec) [1,2,3,6,9] @@ -240,7 +241,7 @@ Inpla is a multi-threaded parallel interpreter of interaction nets. Once you wri ``` $ ./inpla -f sample/qsort.in - Inpla 0.8.0 : Interaction nets as a programming language [built: 27 Feb. 2022] + Inpla 0.9.2-3 : Interaction nets as a programming language [built: 22 August 2022] (22 interactions, 0.00 sec) [1,2,3,6,9] diff --git a/pic/benchmark_reuse_v0.9.2-3.png b/pic/benchmark_reuse_v0.9.2-3.png new file mode 100644 index 0000000..66d9844 Binary files /dev/null and b/pic/benchmark_reuse_v0.9.2-3.png differ -- cgit v1.2.3