~amirouche/xp-web-assembly

44429e0fc3d4724596529c952f6967fc54b6cfe8 — Amirouche 4 months ago cb1d3ef
more benchmarks
4 files changed, 87 insertions(+), 10 deletions(-)

M benchmarks.termgraph.txt
M benchmarks.txt
A test.js
A test.mjs
M benchmarks.termgraph.txt => benchmarks.termgraph.txt +10 -8
@@ 1,10 1,12 @@

chez       : ▏ 2.00 
pypy3      : ▏ 14.00
pypy3/rec  : ▏ 27.00
python3    : ▏ 76.00
python3/rec: ▏ 160.00
chibi      : ▇▇▇▇ 828.00
nodejs     : ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 7156.00
jsshell    : ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 9302.00
chez             : ▏ 2.00 
jsshell          : ▏ 4.00 
nodejs           : ▏ 7.00 
pypy3            : ▏ 14.00
pypy3/rec        : ▏ 27.00
python3          : ▏ 76.00
python3/rec      : ▏ 160.00
chibi            : ▇▇▇▇ 828.00
ruse/nodejs/wasm : ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 7156.00
ruse/jsshell/wasm: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 9302.00


M benchmarks.txt => benchmarks.txt +4 -2
@@ 1,8 1,10 @@
chez 2
jsshell 4
nodejs 7
pypy3 14
pypy3/rec 27
python3 76
python3/rec 160
chibi 828
nodejs 7156
jsshell 9302
ruse/nodejs/wasm 7156
ruse/jsshell/wasm 9302

A test.js => test.js +35 -0
@@ 0,0 1,35 @@
function fib(n) {
    if (n == 0) {
      return 0
    } else {
      let x = 0
      let y = 1
      let z = 0;
      n = n - 1;
      while (true) {
        if (n === 0) {
          break
        }
        z = (x + y)
        x = y
        y = z
        n = n - 1;
      }
      return y;
    }
}

let count = 100000;

let out;
let start = performance.now();

while (true) {
  if (count === 0) {
    break;
  }
  out = fib(16);
  count = count - 1;
}
console.log(out)
console.log(performance.now() - start)

A test.mjs => test.mjs +38 -0
@@ 0,0 1,38 @@
import {performance} from 'perf_hooks';


function fib(n) {
    if (n == 0) {
      return 0
    } else {
      let x = 0
      let y = 1
      let z = 0;
      n = n - 1;
      while (true) {
        if (n === 0) {
          break
        }
        z = (x + y)
        x = y
        y = z
        n = n - 1;
      }
      return y;
    }
}

let count = 100000;

let out;
let start = performance.now();

while (true) {
  if (count === 0) {
    break;
  }
  out = fib(16);
  count = count - 1;
}
console.log(out)
console.log(performance.now() - start)