diff --git a/src/main.c b/src/main.c index cc02b04..d1e9cc9 100644 --- a/src/main.c +++ b/src/main.c @@ -1,13 +1,6 @@ #include "test.h" #include "debug.h" #include "vm.h" -#include -#include -#include -#include -#include -#include -#include #ifdef __EMSCRIPTEN__ #include #endif diff --git a/test/bench/add.wren b/test/bench/add.wren deleted file mode 100644 index fbaca81..0000000 --- a/test/bench/add.wren +++ /dev/null @@ -1,6 +0,0 @@ -var add = Fn.new { |a, b| - return a + b -} - -var sum = add.call(1, 1) -System.print(sum.toString) diff --git a/test/bench/fib.wren b/test/bench/fib.wren deleted file mode 100644 index 564109b..0000000 --- a/test/bench/fib.wren +++ /dev/null @@ -1,10 +0,0 @@ -class Fib { - static fib(n) { - if (n < 2) return n - return fib(n-1) + fib(n-2) - } -} - -var result = Fib.fib(35) - -System.print(result) diff --git a/test/bench/loop.wren b/test/bench/loop.wren deleted file mode 100644 index beca453..0000000 --- a/test/bench/loop.wren +++ /dev/null @@ -1,10 +0,0 @@ -var a = 5.0 -var i = 5 -while (i >= 0) { - a = a + 5.0 - i = i - 1 -} -var b = a -System.write("Enter a string: ") -System.print(a.toString) -System.print(b.toString) diff --git a/test/bench/run.sh b/test/bench/run.sh index f71b44d..564cd49 100755 --- a/test/bench/run.sh +++ b/test/bench/run.sh @@ -16,22 +16,22 @@ print_section() { printf '\n\e[1;34m%s\e[0m\n' "$1" } -# Wren Implementation -print_section "Wren ($FILENAME.wren)" -time wren "$FILENAME.wren" +# Unfair LuaJIT Implementation +print_section "Lua ($FILENAME.lua)" +echo "test input" | time luajit "$FILENAME.lua" # Lua Implementation print_section "Lua ($FILENAME.lua)" -time lua "$FILENAME.lua" +echo "test input" | time lua "$FILENAME.lua" # Perl Implementation print_section "Perl ($FILENAME.pl)" -time perl "$FILENAME.pl" + echo "test input" | time perl "$FILENAME.pl" # Python Implementation print_section "Python ($FILENAME.py)" -time python3 "$FILENAME.py" + echo "test input" | time python3 "$FILENAME.py" # ZRE Implementation print_section "zre ($FILENAME.zre)" -time ../../src/zre "$FILENAME.zre" + echo "test input" | time ../../src/zre "$FILENAME.zre" diff --git a/test/loop.s b/test/loop.s new file mode 100644 index 0000000..bfb52c0 --- /dev/null +++ b/test/loop.s @@ -0,0 +1,19 @@ +main: + loadf $0 5.0 + loadi $1 5 + loadi $2 0 + loadi $3 -1 +loop: + loadf $5 5.0 + addr $0 $0 $5 + addi $1 $1 $3 + loadu $4 &loop + jgei $4 $1 $2 + rtou $1 $0 + gets $2 + utos $3 $1 + puts $3 + rtos $3 $0 + puts $3 + puts $2 + halt