From 009588dbc34e9e187d65e007e3e4608e7c96a94f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Wed, 1 Apr 2020 23:33:01 +0200 Subject: [PATCH] :white_check_mark: Update benchmark --- benchmark/binary-trees.gw | 4 ++-- benchmark/fib-recurs.gw | 1 - benchmark/{fib.gw => fib.ck} | 0 benchmark/for.ck | 10 ++++++++++ benchmark/string-equals.gw | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) rename benchmark/{fib.gw => fib.ck} (100%) create mode 100644 benchmark/for.ck diff --git a/benchmark/binary-trees.gw b/benchmark/binary-trees.gw index af3486c1..d92c5e0e 100644 --- a/benchmark/binary-trees.gw +++ b/benchmark/binary-trees.gw @@ -2,7 +2,7 @@ class Tree { int item; - Tree @left, right; + Tree ref left, right; fun static Tree new_Tree(int it, int depth) { Tree t; @@ -30,7 +30,7 @@ maxDepth + 1 => int stretchDepth; <<< "stretch tree of depth ", stretchDepth, " check: ", Tree.new_Tree(0, stretchDepth).check() >>>; -Tree.new_Tree(0, maxDepth) @=> Tree@ longLivedTree; +Tree.new_Tree(0, maxDepth) @=> Tree ref longLivedTree; #! iterations = 2 ** maxDepth 1 => int iterations; diff --git a/benchmark/fib-recurs.gw b/benchmark/fib-recurs.gw index be2c4ab7..197eec5f 100644 --- a/benchmark/fib-recurs.gw +++ b/benchmark/fib-recurs.gw @@ -4,5 +4,4 @@ fun int recursive_fib(int n) { else return recursive_fib(n - 2) + recursive_fib(n - 1); } -#!<<< 5 => recursive_fib >>>; <<< 40 => recursive_fib >>>; diff --git a/benchmark/fib.gw b/benchmark/fib.ck similarity index 100% rename from benchmark/fib.gw rename to benchmark/fib.ck diff --git a/benchmark/for.ck b/benchmark/for.ck new file mode 100644 index 00000000..e1ca6ed1 --- /dev/null +++ b/benchmark/for.ck @@ -0,0 +1,10 @@ +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/string-equals.gw b/benchmark/string-equals.gw index 6dfa7e62..6b197e1e 100644 --- a/benchmark/string-equals.gw +++ b/benchmark/string-equals.gw @@ -9,7 +9,7 @@ for (int i; i < 1000000; ++i) { if ("" == "abc") ++count; if ("abc" == "abcd") ++count; if ("changed one character" == "changed !ne character") ++count; -#! if ("123" == 123) ++count + if (`${123}` == "123") ++count; if ("a slightly longer string" == "a slightly longer string!") ++count; if ("a slightly longer string" == -- 2.43.0