aboutsummaryrefslogtreecommitdiff
path: root/comparison
diff options
context:
space:
mode:
authorShinya Sato <shinnya.sato@gmail.com>2021-11-10 22:30:51 +0900
committerShinya Sato <shinnya.sato@gmail.com>2021-11-10 22:30:51 +0900
commit4ca1fd6db01e658a06008cbb91451603e0fdf63f (patch)
tree6e3e130d42f827c31fa6125c925dfc91e5c64838 /comparison
parenteb72e29f596d8decfd4bb991178a4a8a90730524 (diff)
parent3812fa60310c0f1bd1012228d8fd023bf1ac456b (diff)
downloadinpla-4ca1fd6db01e658a06008cbb91451603e0fdf63f.tar.gz
inpla-4ca1fd6db01e658a06008cbb91451603e0fdf63f.zip
Merge branch 'develop'
Diffstat (limited to '')
-rw-r--r--comparison/Inpla/sptestInpla.sh2
-rw-r--r--comparison/Inpla/src/msort-800000-reuse.in51
2 files changed, 10 insertions, 43 deletions
diff --git a/comparison/Inpla/sptestInpla.sh b/comparison/Inpla/sptestInpla.sh
index 36044a6..90f7436 100644
--- a/comparison/Inpla/sptestInpla.sh
+++ b/comparison/Inpla/sptestInpla.sh
@@ -5,7 +5,7 @@
# repeat and waittime
-ct=1
+ct=10
waittime=5
max_threads=9
diff --git a/comparison/Inpla/src/msort-800000-reuse.in b/comparison/Inpla/src/msort-800000-reuse.in
index 36723b9..5f57484 100644
--- a/comparison/Inpla/src/msort-800000-reuse.in
+++ b/comparison/Inpla/src/msort-800000-reuse.in
@@ -1,39 +1,11 @@
// Merge sort
MS(ret) >< [] => ret~[];
-MS(ret) >< x:xs => MS_tail(ret, x)~xs;
+MS(ret) >< x:xs => (*L)MS_tail(ret, x)~xs;
-MS_tail(ret, n) >< [] => ret~(*R)[n];
+MS_tail(ret, int n) >< [] => ret~[n];
MS_tail(ret, int n) >< x:xs =>
-// MS(a)~left, MS(b)~right, Append(ret,a)~b,
-// Split(0, left,right) ~ (n:x:xs);
- MS(a)~left, MS(b)~right, Append(ret,a)~b,
- (*L)Split(left,right) ~ (*R)(n:x:xs);
-
-
-/*
-Splitn(int flag, a, b) >< [] => a~[], b~[];
-Splitn(int flag, a, b) >< (int y):ys
-| flag==0 => b~(*R)(y:cnt), (*L)Splitn(1, a, cnt)~ys
-| _ => a~(*R)(y:cnt), (*L)Splitn(0, cnt, b)~ys;
-
-Split(a,b) >< x:xs => Splitn(0,a,b)~x:xs;
-*/
-
-Split(a,b) >< [] => a~[], b~[];
-Split(a,b) >< x:xs => a~(x:cntl), (*L)Split(b,cntl)~xs;
-
-
-
-// この実験から、Merge は悪くないことがわかる。
-// Part でも -t 5 6 7 順に速くなる。
-// つまり、Split が悪いと言える。
-
-/*
-MS_tail(ret, n) >< [] => ret~(*R)[n];
-MS_tail(ret, n) >< x:xs =>
- MS(a)~left, MS(b)~right, Merge(ret,b)~a,
- (*L)Split(left,right) ~ (*R)(n:x:xs);
-*/
+ Split(left,right) ~ (*R)(n:x:xs),
+ MS(a)~left, MS(b)~right, (*L)Merge(ret,b)~a;
Merge(ret, snd) >< [] => ret~snd;
Merge(ret, snd) >< x:xs => (*L)MergeCC(ret, x, xs)~snd;
@@ -42,24 +14,19 @@ MergeCC(ret, int y, ys) >< [] => ret~(*R)(y:ys);
MergeCC(ret, int y, ys) >< (int x):xs
| x <= y => ret~(x:cnt), (*L)MergeCC(cnt, y, ys) ~ xs
| _ => ret~(y:cnt), (*L)MergeCC(cnt, x, xs) ~ ys;
-// ret~(*R)(x:cnt) less improvement
-
-// *** I should make an option that outputs bytecodes to a file. ***
-// *** Then, I have to look the reason why
-// *** ret~(*R)(x:cnt), MergeCC(cnt, y, ys) ~ xs becomes less improvement.
-
+Split(right,left) >< [] => right~[], left~[];
+Split(right,left) >< x:xs =>
+ right~(*R)(x:cntl), left~cntr, (*L)Split(cntr,cntl)~xs;
-// left~cntr, (*L)Split(cntr,cntl)~xs, right~(x:cntl);
-// This also make it less efficient.
-const LIST_ELEM=1200000;
+const LIST_ELEM=800000;
MkRandList(ret) >< (int n)
| n>0 => ret~(rd:cnt), (*L)MkRandList(cnt)~(n-1)
- where rd=rand(LIST_ELEM)
+ where rd=rand(10000)
| _ => ret~[];
MkRandList(cnt)~(LIST_ELEM),