Skip to content

Instantly share code, notes, and snippets.

@jtiemann
jtiemann / gist:fb35530ba7bd0a1c95d8c44548581ea0
Created February 5, 2018 22:36
chap 2-5 haskell class '18
module Lib
( someFunc,
printInc,
halve,
) where
import Data.Aeson
import System.Random
import Data.Maybe
import Data.Char (toUpper)
------------------
$ node --expose-wasm ./factorial.js
js x 1,227,389 ops/sec ±0.27% (96 runs sampled)
wasm x 3,515,196 ops/sec ±0.29% (96 runs sampled)
factorial.js
-------------------
const fs = require('fs');
const buf = fs.readFileSync('./factorial.wasm');
const lib = WebAssembly.instantiate(new Uint8Array(buf).buffer);