From d038cfb92de005048f2cfb00063ddc7ac7ce94ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Fri, 18 Sep 2020 06:05:14 +0200 Subject: [PATCH] No need to benchmark here --- .github/workflows/build.yml | 72 -------------------------- benchmark/binary-trees-gc.wren | 55 -------------------- benchmark/binary-trees.ck | 48 ------------------ benchmark/binary-trees.dart | 56 --------------------- benchmark/binary-trees.gw | 51 ------------------- benchmark/binary-trees.lua | 50 ------------------ benchmark/binary-trees.py | 44 ---------------- benchmark/binary-trees.rb | 49 ------------------ benchmark/binary-trees.wren | 51 ------------------- benchmark/fib-recurs.ck | 10 ---- benchmark/fib-recurs.gw | 7 --- benchmark/fib-recurs.hs | 6 --- benchmark/fib-recurs.lua | 6 --- benchmark/fib-recurs.py | 7 --- benchmark/fib-recurs.rb | 5 -- benchmark/fib-recurs.wren | 8 --- benchmark/fib.ck | 8 --- benchmark/fib.dart | 10 ---- benchmark/fib.lua | 8 --- benchmark/fib.py | 8 --- benchmark/fib.rb | 11 ---- benchmark/fib.wren | 10 ---- benchmark/for.ck | 10 ---- benchmark/for.dart | 10 ---- benchmark/for.gw | 10 ---- benchmark/for.lua | 10 ---- benchmark/for.py | 16 ------ benchmark/for.rb | 6 --- benchmark/for.wren | 8 --- benchmark/method-call.ck.bug | 58 --------------------- benchmark/method-call.dart | 78 ---------------------------- benchmark/method-call.gw | 58 --------------------- benchmark/method-call.lua | 92 ---------------------------------- benchmark/method-call.py | 72 -------------------------- benchmark/method-call.rb | 79 ----------------------------- benchmark/method-call.wren | 66 ------------------------ benchmark/string-equals.ck | 20 -------- benchmark/string-equals.gw | 20 -------- benchmark/string-equals.py | 30 ----------- benchmark/string-equals.wren | 20 -------- gwion-benchmark | 2 +- 41 files changed, 1 insertion(+), 1244 deletions(-) delete mode 100644 benchmark/binary-trees-gc.wren delete mode 100644 benchmark/binary-trees.ck delete mode 100644 benchmark/binary-trees.dart delete mode 100644 benchmark/binary-trees.gw delete mode 100644 benchmark/binary-trees.lua delete mode 100644 benchmark/binary-trees.py delete mode 100644 benchmark/binary-trees.rb delete mode 100644 benchmark/binary-trees.wren delete mode 100644 benchmark/fib-recurs.ck delete mode 100644 benchmark/fib-recurs.gw delete mode 100644 benchmark/fib-recurs.hs delete mode 100644 benchmark/fib-recurs.lua delete mode 100644 benchmark/fib-recurs.py delete mode 100644 benchmark/fib-recurs.rb delete mode 100644 benchmark/fib-recurs.wren delete mode 100644 benchmark/fib.ck delete mode 100644 benchmark/fib.dart delete mode 100644 benchmark/fib.lua delete mode 100644 benchmark/fib.py delete mode 100644 benchmark/fib.rb delete mode 100644 benchmark/fib.wren delete mode 100644 benchmark/for.ck delete mode 100644 benchmark/for.dart delete mode 100644 benchmark/for.gw delete mode 100644 benchmark/for.lua delete mode 100644 benchmark/for.py delete mode 100644 benchmark/for.rb delete mode 100644 benchmark/for.wren delete mode 100644 benchmark/method-call.ck.bug delete mode 100644 benchmark/method-call.dart delete mode 100644 benchmark/method-call.gw delete mode 100644 benchmark/method-call.lua delete mode 100644 benchmark/method-call.py delete mode 100644 benchmark/method-call.rb delete mode 100644 benchmark/method-call.wren delete mode 100644 benchmark/string-equals.ck delete mode 100644 benchmark/string-equals.gw delete mode 100644 benchmark/string-equals.py delete mode 100644 benchmark/string-equals.wren diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66bbebaa..c68dca68 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,78 +67,6 @@ jobs: fi cp gwion .. - - uses: actions/cache@v1 - if: "!contains(github.event.head_commit.message, '[skip benchmark]')" - name: Wren [ cache ] - id: wren - with: - path: wren - key: ${{ runner.os }}-wren - - - name: wren [ init ] - if: "!contains(github.event.head_commit.message, '[skip benchmark]') && steps.wren.outputs.cache-hit != 'true'" - run: | - git clone https://github.com/wren-lang/wren - cd wren/projects/make - make - - - name: wren [ update ] - if: "!contains(github.event.head_commit.message, '[skip benchmark]') && steps.wren.outputs.cache-hit == 'true'" - run: | - cd wren - if [ $(git rev-parse HEAD) != $(git ls-remote https://github.com/wren-lang/wren.git HEAD | cut -f1) ] - then - git pull - cd projects/make - make - fi - - - name: wren [ install ] - if: "!contains(github.event.head_commit.message, '[skip benchmark]')" - run: cp wren/bin/wren_test wren/bin/wren - - - uses: actions/cache@v1 - if: "!contains(github.event.head_commit.message, '[skip benchmark]')" - name: Lua [ cache ] - id: lua - with: - path: lua - key: ${{ runner.os }}-lua - - - name: Lua [ init ] - if: "!contains(github.event.head_commit.message, '[skip benchmark]') && steps.lua.outputs.cache-hit != 'true'" - run: | - git clone https://github.com/lua/lua - cd lua - sudo apt-get install libreadline-dev - make - - - name: Lua [ update ] - if: "!contains(github.event.head_commit.message, '[skip benchmark]') && steps.lua.outputs.cache-hit == 'true'" - run: | - cd lua - if [ $(git rev-parse HEAD) != $(git ls-remote https://github.com/lua/lua.git HEAD | cut -f1) ] - then - git pull - sudo apt-get install libreadline-dev - make - fi - - - name: Benchmark - if: "!contains(github.event.head_commit.message, '[skip benchmark]')" - run: | - echo 1 | sudo tee /proc/sys/kernel/perf_event_paranoid - sudo apt-get update - sudo apt-get install gnuplot chuck - echo 'chuck --silent $@' > ./chuck - chmod +x ./chuck - export PATH=./wren/bin:$PATH - export PATH=./lua:$PATH - export PATH=./mdr:$PATH - export PATH=./Gwion:$PATH - export PATH=.:$PATH - bash scripts/benchmark.sh - - uses: fennecdjay/emojify-docker-action@v2 name: Emojify with: diff --git a/benchmark/binary-trees-gc.wren b/benchmark/binary-trees-gc.wren deleted file mode 100644 index 803202ec..00000000 --- a/benchmark/binary-trees-gc.wren +++ /dev/null @@ -1,55 +0,0 @@ -// Ported from the Python version. - -class Tree { - construct new(item, depth) { - _item = item - if (depth > 0) { - var item2 = item + item - depth = depth - 1 - _left = Tree.new(item2 - 1, depth) - _right = Tree.new(item2, depth) - } - } - - check { - if (_left == null) { - return _item - } - - return _item + _left.check - _right.check - } -} - -var minDepth = 4 -var maxDepth = 12 -var stretchDepth = maxDepth + 1 - -System.print("stretch tree of depth %(stretchDepth) check: " + - "%(Tree.new(0, stretchDepth).check)") -for (i in 1...1000) System.gc() - -var longLivedTree = Tree.new(0, maxDepth) - -// iterations = 2 ** maxDepth -var iterations = 1 -for (d in 0...maxDepth) { - iterations = iterations * 2 -} - -var depth = minDepth -while (depth < stretchDepth) { - var check = 0 - for (i in 1..iterations) { - check = check + Tree.new(i, depth).check + Tree.new(-i, depth).check - } - - System.print("%(iterations * 2) trees of depth %(depth) check: %(check)") - for (i in 1...1000) System.gc() - - iterations = iterations / 4 - depth = depth + 2 -} - -System.print( - "long lived tree of depth %(maxDepth) check: %(longLivedTree.check)") -for (i in 1...1000) System.gc() diff --git a/benchmark/binary-trees.ck b/benchmark/binary-trees.ck deleted file mode 100644 index bbfa5dbc..00000000 --- a/benchmark/binary-trees.ck +++ /dev/null @@ -1,48 +0,0 @@ -class Tree { - int item; - Tree @ left, right; - - fun static Tree new_Tree(int it, int depth) { - Tree t; - it => t.item; - if (depth > 0) { - it + it => int item2; - --depth; - new_Tree(item2 - 1, depth) @=> t.left; - new_Tree(item2, depth) @=> t.right; - } - return t; - } - - fun int check() { - if (left == NULL) - return item; - return item + left.check() - right.check(); - } -} - -4 => int minDepth; -12 => int maxDepth; -maxDepth + 1 => int stretchDepth; - -<<< "stretch tree of depth ", stretchDepth, " check: ", - Tree.new_Tree(0, stretchDepth).check() >>>; - -Tree.new_Tree(0, maxDepth) @=> Tree @ longLivedTree; - -1 => int iterations; -for (int d; d < maxDepth; ++d) - 2 *=> iterations; - -minDepth => int depth; -while (depth < stretchDepth) { - int check; - for (int i; i < iterations; ++i) - Tree.new_Tree(i, depth).check() + Tree.new_Tree(-i, depth).check() +=> check; - - <<< iterations * 2, " trees of depth ", depth, " check: ", check >>>; - 4 /=> iterations; - 2 +=> depth; -} - -<<< "long lived tree of depth ", maxDepth, " check: ", longLivedTree.check() >>>; diff --git a/benchmark/binary-trees.dart b/benchmark/binary-trees.dart deleted file mode 100644 index f7d52d5f..00000000 --- a/benchmark/binary-trees.dart +++ /dev/null @@ -1,56 +0,0 @@ -// Ported from the Wren version. - -class Tree { - var _item; - var _left; - var _right; - - Tree(item, depth) { - _item = item; - if (depth > 0) { - var item2 = item + item; - depth--; - _left = new Tree(item2 - 1, depth); - _right = new Tree(item2, depth); - } - } - - get check { - if (_left == null) { - return _item; - } - - return _item + _left.check - _right.check; - } -} - -main() { - var minDepth = 4; - var maxDepth = 12; - var stretchDepth = maxDepth + 1; - - print("stretch tree of depth ${stretchDepth} check: " - "${new Tree(0, stretchDepth).check}"); - - var longLivedTree = new Tree(0, maxDepth); - - // iterations = 2 ** maxDepth - var iterations = 1; - for (var d = 0; d < maxDepth; d++) { - iterations = iterations * 2; - } - - var depth = minDepth; - while (depth < stretchDepth) { - var check = 0; - for (var i = 1; i <= iterations; i++) { - check += new Tree(i, depth).check + new Tree(-i, depth).check; - } - - print("${iterations * 2} trees of depth ${depth} check: ${check}"); - iterations ~/= 4; - depth += 2; - } - - print("long lived tree of depth ${maxDepth} check: ${longLivedTree.check}"); -} diff --git a/benchmark/binary-trees.gw b/benchmark/binary-trees.gw deleted file mode 100644 index 94e993c3..00000000 --- a/benchmark/binary-trees.gw +++ /dev/null @@ -1,51 +0,0 @@ -#! Ported from the Wren version. - -class Tree { - int item; - Tree ref left, right; - - fun static Tree new_Tree(int it, int depth) { - Tree t; - it => t.item; - if (depth > 0) { - it + it => int item2; - --depth; - new_Tree(item2 - 1, depth) @=> t.left; - new_Tree(item2, depth) @=> t.right; - } - return t; - } - - fun int check() { - if (!left) - return item; - return item + left.check() - right.check(); - } -} - -4 => int minDepth; -12 => int maxDepth; -maxDepth + 1 => int stretchDepth; - -<<< "stretch tree of depth ", stretchDepth, " check: ", - Tree.new_Tree(0, stretchDepth).check() >>>; - -Tree.new_Tree(0, maxDepth) @=> Tree ref longLivedTree; - -#! iterations = 2 ** maxDepth -1 => int iterations; -for (int d; d < maxDepth; ++d) - 2 *=> iterations; - -minDepth => int depth; -while (depth < stretchDepth) { - int check; - for (int i; i < iterations; ++i) - Tree.new_Tree(i, depth).check() + Tree.new_Tree(-i, depth).check() +=> check; - - <<< iterations * 2, " trees of depth ", depth, " check: ", check >>>; - 4 /=> iterations; - 2 +=> depth; -} - -<<< "long lived tree of depth ", maxDepth, " check: ", longLivedTree.check() >>>; diff --git a/benchmark/binary-trees.lua b/benchmark/binary-trees.lua deleted file mode 100644 index e690c270..00000000 --- a/benchmark/binary-trees.lua +++ /dev/null @@ -1,50 +0,0 @@ --- The Computer Language Benchmarks Game --- http://shootout.alioth.debian.org/ --- contributed by Mike Pall - -local function BottomUpTree(item, depth) - if depth > 0 then - local i = item + item - depth = depth - 1 - local left, right = BottomUpTree(i-1, depth), BottomUpTree(i, depth) - return { item, left, right } - else - return { item } - end -end - -local function ItemCheck(tree) - if tree[2] then - return tree[1] + ItemCheck(tree[2]) - ItemCheck(tree[3]) - else - return tree[1] - end -end - -local N = 12 -local mindepth = 4 -local maxdepth = mindepth + 2 -if maxdepth < N then maxdepth = N end - -do - local stretchdepth = maxdepth + 1 - local stretchtree = BottomUpTree(0, stretchdepth) - io.write(string.format("stretch tree of depth %d check: %d\n", - stretchdepth, ItemCheck(stretchtree))) -end - -local longlivedtree = BottomUpTree(0, maxdepth) - -for depth=mindepth,maxdepth,2 do - local iterations = 2 ^ (maxdepth - depth + mindepth) - local check = 0 - for i=1,iterations do - check = check + ItemCheck(BottomUpTree(1, depth)) + - ItemCheck(BottomUpTree(-1, depth)) - end - io.write(string.format("%d trees of depth %d check: %d\n", - iterations*2, depth, check)) -end - -io.write(string.format("long lived tree of depth %d check: %d\n", - maxdepth, ItemCheck(longlivedtree))) diff --git a/benchmark/binary-trees.py b/benchmark/binary-trees.py deleted file mode 100644 index b08adf3b..00000000 --- a/benchmark/binary-trees.py +++ /dev/null @@ -1,44 +0,0 @@ -# The Computer Language Benchmarks Game -# http://shootout.alioth.debian.org/ -# -# contributed by Antoine Pitrou -# modified by Dominique Wahli -# modified by Heinrich Acker -from __future__ import print_function - -# Map "range" to an efficient range in both Python 2 and 3. -try: - range = xrange -except NameError: - pass - -def make_tree(item, depth): - if not depth: return item, None, None - item2 = item + item - depth -= 1 - return item, make_tree(item2 - 1, depth), make_tree(item2, depth) - -def check_tree(node): - item, left, right = node - if not left: return item - return item + check_tree(left) - check_tree(right) - -min_depth = 4 -max_depth = 12 -stretch_depth = max_depth + 1 - -print("stretch tree of depth %d check:" % stretch_depth, check_tree(make_tree(0, stretch_depth))) - -long_lived_tree = make_tree(0, max_depth) - -iterations = 2 ** max_depth -for depth in range(min_depth, stretch_depth, 2): - - check = 0 - for i in range(1, iterations + 1): - check += check_tree(make_tree(i, depth)) + check_tree(make_tree(-i, depth)) - - print("%d trees of depth %d check:" % (iterations * 2, depth), check) - iterations //= 4 - -print("long lived tree of depth %d check:" % max_depth, check_tree(long_lived_tree)) diff --git a/benchmark/binary-trees.rb b/benchmark/binary-trees.rb deleted file mode 100644 index 2118083c..00000000 --- a/benchmark/binary-trees.rb +++ /dev/null @@ -1,49 +0,0 @@ -# The Computer Language Shootout Benchmarks -# http://shootout.alioth.debian.org -# -# contributed by Jesse Millikan -# Modified by Wesley Moxam - - -def item_check(left, item, right) - return item if left.nil? - item + item_check(*left) - item_check(*right) -end - -def bottom_up_tree(item, depth) - return [nil, item, nil] unless depth > 0 - item_item = 2 * item - depth -= 1 - [bottom_up_tree(item_item - 1, depth), item, bottom_up_tree(item_item, depth)] -end - -max_depth = 12 -min_depth = 4 - -max_depth = min_depth + 2 if min_depth + 2 > max_depth - -stretch_depth = max_depth + 1 -stretch_tree = bottom_up_tree(0, stretch_depth) - -puts "stretch tree of depth #{stretch_depth} check: #{item_check(*stretch_tree)}" -stretch_tree = nil - -long_lived_tree = bottom_up_tree(0, max_depth) - -min_depth.step(max_depth + 1, 2) do |depth| - iterations = 2**(max_depth - depth + min_depth) - - check = 0 - - for i in 1..iterations - temp_tree = bottom_up_tree(i, depth) - check += item_check(*temp_tree) - - temp_tree = bottom_up_tree(-i, depth) - check += item_check(*temp_tree) - end - - puts "#{iterations * 2} trees of depth #{depth} check: #{check}" -end - -puts "long lived tree of depth #{max_depth} check: #{item_check(*long_lived_tree)}" diff --git a/benchmark/binary-trees.wren b/benchmark/binary-trees.wren deleted file mode 100644 index 2393462b..00000000 --- a/benchmark/binary-trees.wren +++ /dev/null @@ -1,51 +0,0 @@ -// Ported from the Python version. - -class Tree { - construct new(item, depth) { - _item = item - if (depth > 0) { - var item2 = item + item - depth = depth - 1 - _left = Tree.new(item2 - 1, depth) - _right = Tree.new(item2, depth) - } - } - - check { - if (_left == null) { - return _item - } - - return _item + _left.check - _right.check - } -} - -var minDepth = 4 -var maxDepth = 12 -var stretchDepth = maxDepth + 1 - -System.print("stretch tree of depth %(stretchDepth) check: " + - "%(Tree.new(0, stretchDepth).check)") - -var longLivedTree = Tree.new(0, maxDepth) - -// iterations = 2 ** maxDepth -var iterations = 1 -for (d in 0...maxDepth) { - iterations = iterations * 2 -} - -var depth = minDepth -while (depth < stretchDepth) { - var check = 0 - for (i in 1..iterations) { - check = check + Tree.new(i, depth).check + Tree.new(-i, depth).check - } - - System.print("%(iterations * 2) trees of depth %(depth) check: %(check)") - iterations = iterations / 4 - depth = depth + 2 -} - -System.print( - "long lived tree of depth %(maxDepth) check: %(longLivedTree.check)") diff --git a/benchmark/fib-recurs.ck b/benchmark/fib-recurs.ck deleted file mode 100644 index c0026c47..00000000 --- a/benchmark/fib-recurs.ck +++ /dev/null @@ -1,10 +0,0 @@ -//int count = 0; -fun int recursive_fib(int n) -{ -// ++count; - if (n < 2) - return n; - else - return recursive_fib(n - 2) + recursive_fib(n - 1); -} -<<>>; diff --git a/benchmark/fib-recurs.gw b/benchmark/fib-recurs.gw deleted file mode 100644 index 197eec5f..00000000 --- a/benchmark/fib-recurs.gw +++ /dev/null @@ -1,7 +0,0 @@ -fun int recursive_fib(int n) { - if (n < 2) - return n; - else - return recursive_fib(n - 2) + recursive_fib(n - 1); -} -<<< 40 => recursive_fib >>>; diff --git a/benchmark/fib-recurs.hs b/benchmark/fib-recurs.hs deleted file mode 100644 index 6929769e..00000000 --- a/benchmark/fib-recurs.hs +++ /dev/null @@ -1,6 +0,0 @@ -fib :: Int -> Int -fib n - | n < 2 = n - | otherwise = (fib (n-2)) + (fib (n-1)) - -main = print $ fib 40 diff --git a/benchmark/fib-recurs.lua b/benchmark/fib-recurs.lua deleted file mode 100644 index 51765408..00000000 --- a/benchmark/fib-recurs.lua +++ /dev/null @@ -1,6 +0,0 @@ -local function fib(n) - if n < 2 then return n end - return fib(n - 1) + fib(n - 2) -end - -print(fib(40)) diff --git a/benchmark/fib-recurs.py b/benchmark/fib-recurs.py deleted file mode 100644 index 672317f8..00000000 --- a/benchmark/fib-recurs.py +++ /dev/null @@ -1,7 +0,0 @@ -def fibonacci_recurs(n): - if n < 2: - return n; - else: - return (fibonacci_recurs(n-1) + fibonacci_recurs(n-2)) - -print(fibonacci_recurs(40)) diff --git a/benchmark/fib-recurs.rb b/benchmark/fib-recurs.rb deleted file mode 100644 index 00f33f13..00000000 --- a/benchmark/fib-recurs.rb +++ /dev/null @@ -1,5 +0,0 @@ -def fibonacci_recurs( n ) - if n < 2 then return n end - return ( fibonacci_recurs( n - 1 ) + fibonacci_recurs( n - 2 ) ) -end -puts fibonacci_recurs(40) diff --git a/benchmark/fib-recurs.wren b/benchmark/fib-recurs.wren deleted file mode 100644 index db980c49..00000000 --- a/benchmark/fib-recurs.wren +++ /dev/null @@ -1,8 +0,0 @@ -class Fib { - static get(n) { - if (n < 2) return n - return get(n - 1) + get(n - 2) - } -} - -System.print(Fib.get(40)) diff --git a/benchmark/fib.ck b/benchmark/fib.ck deleted file mode 100644 index 19f56b93..00000000 --- a/benchmark/fib.ck +++ /dev/null @@ -1,8 +0,0 @@ -class Fib { - fun static int get(int n) { - if (n < 2) return n; - return get(n - 1) + get(n - 2); - } -} -repeat(5) - <<< Fib.get(28) >>>; diff --git a/benchmark/fib.dart b/benchmark/fib.dart deleted file mode 100644 index 3ffa670b..00000000 --- a/benchmark/fib.dart +++ /dev/null @@ -1,10 +0,0 @@ -fib(n) { - if (n < 2) return n; - return fib(n - 1) + fib(n - 2); -} - -main() { - for (var i = 0; i < 5; i++) { - print(fib(28)); - } -} diff --git a/benchmark/fib.lua b/benchmark/fib.lua deleted file mode 100644 index a4f06e7c..00000000 --- a/benchmark/fib.lua +++ /dev/null @@ -1,8 +0,0 @@ -function fib(n) - if n < 2 then return n end - return fib(n - 2) + fib(n - 1) -end - -for i = 1, 5 do - io.write(fib(28) .. "\n") -end diff --git a/benchmark/fib.py b/benchmark/fib.py deleted file mode 100644 index c2f3ba4d..00000000 --- a/benchmark/fib.py +++ /dev/null @@ -1,8 +0,0 @@ -from __future__ import print_function - -def fib(n): - if n < 2: return n - return fib(n - 1) + fib(n - 2) - -for i in range(0, 5): - print(fib(28)) diff --git a/benchmark/fib.rb b/benchmark/fib.rb deleted file mode 100644 index c496913b..00000000 --- a/benchmark/fib.rb +++ /dev/null @@ -1,11 +0,0 @@ -def fib(n) - if n < 2 then - n - else - fib(n - 1) + fib(n - 2) - end -end - -for i in 0...5 - puts fib(28) -end diff --git a/benchmark/fib.wren b/benchmark/fib.wren deleted file mode 100644 index 441a7e69..00000000 --- a/benchmark/fib.wren +++ /dev/null @@ -1,10 +0,0 @@ -class Fib { - static get(n) { - if (n < 2) return n - return get(n - 1) + get(n - 2) - } -} - -for (i in 1..5) { - System.print(Fib.get(28)) -} diff --git a/benchmark/for.ck b/benchmark/for.ck deleted file mode 100644 index e1ca6ed1..00000000 --- a/benchmark/for.ck +++ /dev/null @@ -1,10 +0,0 @@ -int list[0]; - -for (int i; i < 1000000; ++i) - list << i; - -int sum; -for (int i; i < list.size(); ++i) - i +=> sum; - -<<< sum >>>; diff --git a/benchmark/for.dart b/benchmark/for.dart deleted file mode 100644 index 14aadbd4..00000000 --- a/benchmark/for.dart +++ /dev/null @@ -1,10 +0,0 @@ -main() { - var list = []; - - for (var i = 0; i < 1000000; i++) list.add(i); - - var sum = 0; - for (i in list) sum += i; - - print(sum); -} diff --git a/benchmark/for.gw b/benchmark/for.gw deleted file mode 100644 index 21d505f8..00000000 --- a/benchmark/for.gw +++ /dev/null @@ -1,10 +0,0 @@ -int list[0]; - -for (int i; i < 1000000; ++i) - list << i; - -int sum; -foreach(i : list) - i +=> sum; - -<<< sum >>>; diff --git a/benchmark/for.lua b/benchmark/for.lua deleted file mode 100644 index b03654b3..00000000 --- a/benchmark/for.lua +++ /dev/null @@ -1,10 +0,0 @@ -local list = {} -for i = 0, 999999 do - list[i] = i -end - -local sum = 0 -for k, i in pairs(list) do - sum = sum + i -end -io.write(sum .. "\n") diff --git a/benchmark/for.py b/benchmark/for.py deleted file mode 100644 index cf31ddab..00000000 --- a/benchmark/for.py +++ /dev/null @@ -1,16 +0,0 @@ -from __future__ import print_function - -# Map "range" to an efficient range in both Python 2 and 3. -try: - range = xrange -except NameError: - pass - -list = [] -for i in range(0, 1000000): - list.append(i) - -sum = 0 -for i in list: - sum += i -print(sum) diff --git a/benchmark/for.rb b/benchmark/for.rb deleted file mode 100644 index 87b9d79d..00000000 --- a/benchmark/for.rb +++ /dev/null @@ -1,6 +0,0 @@ -list = [] -1000000.times {|i| list << i} - -sum = 0 -list.each {|i| sum += i} -puts sum diff --git a/benchmark/for.wren b/benchmark/for.wren deleted file mode 100644 index ef259783..00000000 --- a/benchmark/for.wren +++ /dev/null @@ -1,8 +0,0 @@ -var list = [] - -for (i in 0...1000000) list.add(i) - -var sum = 0 -for (i in list) sum = sum + i - -System.print(sum) diff --git a/benchmark/method-call.ck.bug b/benchmark/method-call.ck.bug deleted file mode 100644 index 5e09599e..00000000 --- a/benchmark/method-call.ck.bug +++ /dev/null @@ -1,58 +0,0 @@ -class Toggle { - int state; - fun int value() { return state; } - fun Toggle activate() { - !state => state; - return this; - } -} - -class NthToggle extends Toggle { - int count, countMax; - fun Toggle activate() { - if(++count >= countMax) { - (this $ Toggle).activate(); - 0 => count; - } - return this; - } -} - -100000 => int n; - -Toggle toggle; -true => int val => toggle.state; - -repeat(n) { - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; -} - -<<< toggle.value() >>>; - -NthToggle ntoggle; -true => val => ntoggle.state; -3 => ntoggle.countMax; - -repeat(n) { - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; -} - -<<< ntoggle.value() >>>; diff --git a/benchmark/method-call.dart b/benchmark/method-call.dart deleted file mode 100644 index 540a8266..00000000 --- a/benchmark/method-call.dart +++ /dev/null @@ -1,78 +0,0 @@ -class Toggle { - var _state; - - Toggle(startState) { - _state = startState; - } - - get value => _state; - - activate() { - _state = !_state; - return this; - } -} - -class NthToggle extends Toggle { - var _count; - var _countMax; - - NthToggle(startState, maxCounter) - : super(startState) { - _countMax = maxCounter; - _count = 0; - } - - activate() { - _count = _count + 1; - if (_count >= _countMax) { - super.activate(); - _count = 0; - } - - return this; - } -} - -main() { - Stopwatch watch = new Stopwatch(); - watch.start(); - - var n = 100000; - var val = true; - var toggle = new Toggle(val); - - for (var i = 0; i < n; i++) { - val = toggle.activate().value; - val = toggle.activate().value; - val = toggle.activate().value; - val = toggle.activate().value; - val = toggle.activate().value; - val = toggle.activate().value; - val = toggle.activate().value; - val = toggle.activate().value; - val = toggle.activate().value; - val = toggle.activate().value; - } - - print(toggle.value); - - val = true; - var ntoggle = new NthToggle(val, 3); - - for (var i = 0; i < n; i++) { - val = ntoggle.activate().value; - val = ntoggle.activate().value; - val = ntoggle.activate().value; - val = ntoggle.activate().value; - val = ntoggle.activate().value; - val = ntoggle.activate().value; - val = ntoggle.activate().value; - val = ntoggle.activate().value; - val = ntoggle.activate().value; - val = ntoggle.activate().value; - } - - print(ntoggle.value); - print("elapsed: ${watch.elapsedMilliseconds / 1000}"); -} diff --git a/benchmark/method-call.gw b/benchmark/method-call.gw deleted file mode 100644 index 5a17f900..00000000 --- a/benchmark/method-call.gw +++ /dev/null @@ -1,58 +0,0 @@ -class Toggle { - bool state; - fun bool value() { return state; } - fun Toggle activate() { - !state => state; - return this; - } -} - -class NthToggle extends Toggle { - int count, countMax; - fun Toggle activate() { - if(++count >= countMax) { - (this $ Toggle).activate(); - 0 => count; - } - return this; - } -} - -100000 => int n; - -Toggle toggle; -true => bool val => toggle.state; - -repeat(n) { - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; - toggle.activate().value() => val; -} - -<<< toggle.value() >>>; - -NthToggle ntoggle; -true => val => ntoggle.state; -3 => ntoggle.countMax; - -repeat(n) { - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; - ntoggle.activate().value() => val; -} - -<<< ntoggle.value() >>>; diff --git a/benchmark/method-call.lua b/benchmark/method-call.lua deleted file mode 100644 index 20a6d6ac..00000000 --- a/benchmark/method-call.lua +++ /dev/null @@ -1,92 +0,0 @@ --- $Id: methcall.lua,v 1.2 2004-06-12 16:19:43 bfulgham Exp $ --- http://shootout.alioth.debian.org --- contributed by Roberto Ierusalimschy - --------------------------------------------------------------- --- Toggle class --------------------------------------------------------------- - -Toggle = {} - -function Toggle:value () - return self.state -end - -function Toggle:activate () - self.state = not self.state - return self -end - -function Toggle:new (start_state) - local o = {state = start_state} - self.__index =self - setmetatable(o, self) - return o -end - - --------------------------------------------------------------- --- NthToggle class --------------------------------------------------------------- - -NthToggle = Toggle:new() - -function NthToggle:activate () - self.counter = self.counter + 1 - if self.counter >= self.count_max then - Toggle.activate(self) - self.counter = 0 - end - return self -end - -function NthToggle:new (start_state, max_counter) - local o = Toggle.new(self, start_state) - o.count_max = max_counter - o.counter = 0 - return o -end - - ------------------------------------------------------------ --- main ------------------------------------------------------------ - -function main () - local N = 100000 - - local val = 1 - local toggle = Toggle:new(val) - for i=1,N do - val = toggle:activate():value() - val = toggle:activate():value() - val = toggle:activate():value() - val = toggle:activate():value() - val = toggle:activate():value() - val = toggle:activate():value() - val = toggle:activate():value() - val = toggle:activate():value() - val = toggle:activate():value() - val = toggle:activate():value() - end - print(val and "true" or "false") - - val = 1 - local ntoggle = NthToggle:new(val, 3) - for i=1,N do - val = ntoggle:activate():value() - val = ntoggle:activate():value() - val = ntoggle:activate():value() - val = ntoggle:activate():value() - val = ntoggle:activate():value() - val = ntoggle:activate():value() - val = ntoggle:activate():value() - val = ntoggle:activate():value() - val = ntoggle:activate():value() - val = ntoggle:activate():value() - end - print(val and "true" or "false") -end - -main() - diff --git a/benchmark/method-call.py b/benchmark/method-call.py deleted file mode 100644 index c307a899..00000000 --- a/benchmark/method-call.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/python -# http://www.bagley.org/~doug/shootout/ -from __future__ import print_function - -# Map "range" to an efficient range in both Python 2 and 3. -try: - range = xrange -except NameError: - pass - -class Toggle(object): - def __init__(self, start_state): - self.bool = start_state - def value(self): - return(self.bool) - def activate(self): - self.bool = not self.bool - return(self) - -class NthToggle(Toggle): - def __init__(self, start_state, max_counter): - Toggle.__init__(self, start_state) - self.count_max = max_counter - self.counter = 0 - def activate(self): - self.counter += 1 - if (self.counter >= self.count_max): - super(NthToggle, self).activate() - self.counter = 0 - return(self) - - -def main(): - NUM = 100000 - - val = 1 - toggle = Toggle(val) - for i in range(0,NUM): - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - if val: - print("true") - else: - print("false") - - val = 1 - ntoggle = NthToggle(val, 3) - for i in range(0,NUM): - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - if val: - print("true") - else: - print("false") - -main() diff --git a/benchmark/method-call.rb b/benchmark/method-call.rb deleted file mode 100644 index 40611589..00000000 --- a/benchmark/method-call.rb +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/ruby -# -*- mode: ruby -*- -# $Id: methcall.ruby,v 1.1 2004-05-19 18:10:41 bfulgham Exp $ -# http://www.bagley.org/~doug/shootout/ -# with help from Aristarkh Zagorodnikov - -class Toggle - def initialize(start_state) - @bool = start_state - end - - def value - @bool - end - - def activate - @bool = !@bool - self - end -end - -class NthToggle < Toggle - def initialize(start_state, max_counter) - super start_state - @count_max = max_counter - @counter = 0 - end - - def activate - @counter += 1 - if @counter >= @count_max - super - @counter = 0 - end - self - end -end - -def main() - start = Time.now - - n = 100000 - - val = 1 - toggle = Toggle.new(val) - n.times do - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - val = toggle.activate().value() - end - if val then puts "true" else puts "false" end - - val = 1 - ntoggle = NthToggle.new(val, 3) - n.times do - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - val = ntoggle.activate().value() - end - if val then puts "true" else puts "false" end - - puts "elapsed: " + (Time.now - start).to_s -end - -main() diff --git a/benchmark/method-call.wren b/benchmark/method-call.wren deleted file mode 100644 index 33716ce2..00000000 --- a/benchmark/method-call.wren +++ /dev/null @@ -1,66 +0,0 @@ -class Toggle { - construct new(startState) { - _state = startState - } - - value { _state } - activate { - _state = !_state - return this - } -} - -class NthToggle is Toggle { - construct new(startState, maxCounter) { - super(startState) - _countMax = maxCounter - _count = 0 - } - - activate { - _count = _count + 1 - if (_count >= _countMax) { - super.activate - _count = 0 - } - - return this - } -} - -var n = 100000 -var val = true -var toggle = Toggle.new(val) - -for (i in 0...n) { - val = toggle.activate.value - val = toggle.activate.value - val = toggle.activate.value - val = toggle.activate.value - val = toggle.activate.value - val = toggle.activate.value - val = toggle.activate.value - val = toggle.activate.value - val = toggle.activate.value - val = toggle.activate.value -} - -System.print(toggle.value) - -val = true -var ntoggle = NthToggle.new(val, 3) - -for (i in 0...n) { - val = ntoggle.activate.value - val = ntoggle.activate.value - val = ntoggle.activate.value - val = ntoggle.activate.value - val = ntoggle.activate.value - val = ntoggle.activate.value - val = ntoggle.activate.value - val = ntoggle.activate.value - val = ntoggle.activate.value - val = ntoggle.activate.value -} - -System.print(ntoggle.value) diff --git a/benchmark/string-equals.ck b/benchmark/string-equals.ck deleted file mode 100644 index 8751efe5..00000000 --- a/benchmark/string-equals.ck +++ /dev/null @@ -1,20 +0,0 @@ -int count; -for (int i; i < 1000000; ++i) { - if ("abc" == "abc") ++count; - if ("a slightly longer string" == - "a slightly longer string") ++count; - if ("a significantly longer string but still not overwhelmingly long string" == - "a significantly longer string but still not overwhelmingly long string") ++count; - - if ("" == "abc") ++count; - if ("abc" == "abcd") ++count; - if ("changed one character" == "changed !ne character") ++count; - if ("a slightly longer string" == - "a slightly longer string!") ++count; - if ("a slightly longer string" == - "a slightly longer strinh") ++count; - if ("a significantly longer string but still not overwhelmingly long string" == - "another") ++count; -} - -<<< count >>>; diff --git a/benchmark/string-equals.gw b/benchmark/string-equals.gw deleted file mode 100644 index 8751efe5..00000000 --- a/benchmark/string-equals.gw +++ /dev/null @@ -1,20 +0,0 @@ -int count; -for (int i; i < 1000000; ++i) { - if ("abc" == "abc") ++count; - if ("a slightly longer string" == - "a slightly longer string") ++count; - if ("a significantly longer string but still not overwhelmingly long string" == - "a significantly longer string but still not overwhelmingly long string") ++count; - - if ("" == "abc") ++count; - if ("abc" == "abcd") ++count; - if ("changed one character" == "changed !ne character") ++count; - if ("a slightly longer string" == - "a slightly longer string!") ++count; - if ("a slightly longer string" == - "a slightly longer strinh") ++count; - if ("a significantly longer string but still not overwhelmingly long string" == - "another") ++count; -} - -<<< count >>>; diff --git a/benchmark/string-equals.py b/benchmark/string-equals.py deleted file mode 100644 index 4be9eb1f..00000000 --- a/benchmark/string-equals.py +++ /dev/null @@ -1,30 +0,0 @@ -from __future__ import print_function - -count = 0 -for i in range(0, 1000000): - if "abc" == "abc": - count = count + 1 - if "a slightly longer string" == \ - "a slightly longer string": - count = count + 1 - if "a significantly longer string but still not overwhelmingly long string" == \ - "a significantly longer string but still not overwhelmingly long string": - count = count + 1 - - if "" == "abc": - count = count + 1 - if "abc" == "abcd": - count = count + 1 - if "changed one character" == "changed !ne character": - count = count + 1 - if "a slightly longer string" == \ - "a slightly longer string!": - count = count + 1 - if "a slightly longer string" == \ - "a slightly longer strinh": - count = count + 1 - if "a significantly longer string but still not overwhelmingly long string" == \ - "another": - count = count + 1 - -print(count) diff --git a/benchmark/string-equals.wren b/benchmark/string-equals.wren deleted file mode 100644 index 96d7dbf6..00000000 --- a/benchmark/string-equals.wren +++ /dev/null @@ -1,20 +0,0 @@ -var count = 0 -for (i in 1..1000000) { - if ("abc" == "abc") count = count + 1 - if ("a slightly longer string" == - "a slightly longer string") count = count + 1 - if ("a significantly longer string but still not overwhelmingly long string" == - "a significantly longer string but still not overwhelmingly long string") count = count + 1 - - if ("" == "abc") count = count + 1 - if ("abc" == "abcd") count = count + 1 - if ("changed one character" == "changed !ne character") count = count + 1 - if ("a slightly longer string" == - "a slightly longer string!") count = count + 1 - if ("a slightly longer string" == - "a slightly longer strinh") count = count + 1 - if ("a significantly longer string but still not overwhelmingly long string" == - "another") count = count + 1 -} - -System.print(count) diff --git a/gwion-benchmark b/gwion-benchmark index 1cf2cf36..bd1767a9 160000 --- a/gwion-benchmark +++ b/gwion-benchmark @@ -1 +1 @@ -Subproject commit 1cf2cf3600dac43c02ca16a209d46e2ce5d33dfc +Subproject commit bd1767a9a0d89e3e6fbda313f61912afc9f2a1d8 -- 2.43.0