summaryrefslogtreecommitdiff
path: root/test/binaryen.js/browser-benchmark-compile-wast.html
diff options
context:
space:
mode:
Diffstat (limited to 'test/binaryen.js/browser-benchmark-compile-wast.html')
-rw-r--r--test/binaryen.js/browser-benchmark-compile-wast.html91
1 files changed, 0 insertions, 91 deletions
diff --git a/test/binaryen.js/browser-benchmark-compile-wast.html b/test/binaryen.js/browser-benchmark-compile-wast.html
deleted file mode 100644
index 2431f372e..000000000
--- a/test/binaryen.js/browser-benchmark-compile-wast.html
+++ /dev/null
@@ -1,91 +0,0 @@
-<!DOCTYPE HTML>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Binaryen</title>
- <style type="text/css">
-
-* { margin:0; padding:0; font-family:inherit; }
-body {
- margin:2em;
- background:white;
- color:black;
- font:14px monospace;
- white-space: pre;
-}
-p {
- white-space: normal;
- font-family:sans-serif;
-}
-
- </style>
- <script type="text/javascript" src="../../bin/binaryen.js"></script>
- </head>
- <body><script type="text/javascript">
-// Separate javascript tag to support <=ES3 browser (the other block uses ES5 and ES6 features)
-if (!window.Wasm) {
- var e = document.createElement('p');
- e.innerHTML = 'No WASM support detected.<br>Please see <a href="https://github.com/kripken/emscripten/wiki/WebAssembly#testing-native-webassembly-in-browsers">https://github.com/kripken/emscripten/wiki/WebAssembly#testing-native-webassembly-in-browsers</a> for instructions on how to enable it.';
- document.body.appendChild(e);
-}
-</script><script type="text/javascript">
-if (window.Wasm) {
- document.write("See console");
-
- let initStart = Date.now();
- Binaryen = Binaryen();
- let initDuration = Date.now() - initStart;
- console.log('initializing module by calling Binaryen(): '+initDuration+'ms');
-
- let input1 =`
- (module
- (export "add" $add)
- (import $add2 "env" "add" (param f64 f64) (result f64))
- (func $add (param $x f64) (param $y f64) (result f64)
- (f64.add
- (call_import $add2 (get_local $x) (get_local $y))
- (f64.add (get_local $x) (get_local $y))
- )
- )
- )`;
- let startTime = 0, endTime = 0;
- let yieldStartTime = 0, yieldEndTime = 0;
- let iterations = 10000000;
- let yieldAt = 10000;
- let i = 0;
- let end = () => {
- let duration = endTime - startTime;
- console.log('benchmark ended: '+(duration / iterations)+' ms/call ('+duration+' ms)')
- }
-
- let runChunk = () => {
- yieldEndTime = Date.now();
- if (yieldStartTime) {
- // subtract time spent yielding
- startTime += yieldEndTime - yieldStartTime;
- }
- for (; i < iterations; ++i) {
- if (i != 0 && i % yieldAt == 0) {
- break;
- }
- let buf = Binaryen.compileWast(input1);
- }
- if (i < iterations) {
- endTime = Date.now();
- end();
- } else {
- // yield main thread
- yieldStartTime = Date.now();
- setTimeout(chunk, 0);
- }
- }
-
- console.log('benchmark starting')
- startTime = Date.now();
- runChunk();
-
-}
-
-</script>
-</body>
-</html> \ No newline at end of file