diff --git a/.gitignore b/.gitignore index 2a8381cf9..f1af4c3a5 100644 --- a/.gitignore +++ b/.gitignore @@ -77,4 +77,8 @@ glimmer-*/tmp Cargo.lock # emacs -*~ \ No newline at end of file +*~ + +**/bundled-dist/*.js +**/bundled-dist/*.wasm +**/bundled-dist/*.html diff --git a/README.md b/README.md index 9a0bdceed..ea67a81f6 100755 --- a/README.md +++ b/README.md @@ -37,7 +37,9 @@ There are 3 framework entries in this repository: * `keyed/yew` * `keyed/yew-baseline` _(Used to determine if recent changes improved performance)_ -### 1. Prerequisites +### Prerequisites + +#### Install Node Have *node.js (>=10.0)* installed. We recommend using `nvm` to manage node versions The benchmark has been tested with node v12.16.2. Please make sure that the following command work before trying to build: @@ -51,136 +53,23 @@ v12.16.2 v12.16.2 ``` -### Install `chromedriver` +#### Install `chromedriver` https://chromedriver.chromium.org/downloads -### Setup local server - -You can use any server which properly handles the MIME type of wasm files. We recommend the `https` crate: +#### Install local server ``` cargo install https ``` -Start server in the root directory -``` -http -p 8080 -``` - -Verify that the server works: -Try to open [http://localhost:8080/index.html](http://localhost:8080/index.html). If you see something like that you're on the right track: -![Index.html](images/index.png?raw=true "Index.html") - -Now open a new terminal window and keep `http` running in background. - -### 2. Building and running a single framework - -We now try to build a framework. Go to the `wasm-bindgen` reference implementation -``` -cd frameworks/keyed/wasm-bindgen -``` -and install the dependencies -``` -npm install -``` -and build the framework -``` -npm run build-prod -``` -There should be no build errors and we can open the framework in the browser: -[http://localhost:8080/frameworks/keyed/wasm-bindgen/index.html](http://localhost:8080/frameworks/keyed/wasm-bindgen/index.html) - -## 3. Running a single framework with the automated benchmark driver - -The benchmark uses an automated benchmark driver using `chromedriver` to measure the duration for each operation using chrome's timeline. Here are the steps to run for a single framework: +Make sure port `8080` is not taken. ### Run benchmarks -First, navigate to the `webdriver-ts/` directory. - -and install the dependencies -``` -npm install -``` -and build the benchmark driver -``` -npm run build-prod -``` -now run the benchmark driver for the "wasmbindgen-keyed" framework: -``` -npm run bench -- --headless keyed/wasm-bindgen -``` -Just lean back and wait for chrome to run the benchmarks. -Keep an eye on the console output to see if benchmark checks are timing out. If so, visit [http://localhost:8080/frameworks/keyed/wasm-bindgen/index.html](http://localhost:8080/frameworks/keyed/wasm-bindgen/index.html) and check for console errors. You could also try without using `--headless` to debug. - -The results for that run will be saved in the `webdriver-ts/results` directory. We can take a look at the results of a single result: -``` -cat results/wasm-bindgen-v0.2.47-keyed_01_run1k.json - -{ - "framework": "wasm-bindgen-v0.2.47-keyed", - "keyed": true, - "benchmark": "01_run1k", - "type": "cpu", - "min": 101.123, - "max": 114.547, - "mean": 107.69300000000001, - "median": 105.821, - "geometricMean": 107.5587774247631, - "standardDeviation": 6.028027040417119, - "values": [ - 114.547, - 113.509, - 103.465, - 105.821, - 101.123 - ] -} -``` -As you can see the mean duration for create 1000 rows was 107 msecs. - -You can also check whether the implementation appears to be compliant to the rules: -``` -npm run check keyed/wasm-bindgen -``` -If it finds anything it'll report an ERROR. - -## 4. Building the result table - -Install libraries -``` -(cd webdriver-ts-results && npm install) -``` - -In the webdriver-ts directory issue the following command: -``` -npm run results -``` -Now a result table should have been created which can be opened on [http://localhost:8080/webdriver-ts-results/table.html](http://localhost:8080/webdriver-ts-results/table.html). - -## 5. Building and running the benchmarks for all frameworks - -From the base directory, you can build all frameworks by running ``` -npm install -npm run build-prod +./benchmark_change.sh $CHANGED_YEW_PROJECT ``` - -You can now run the benchmark for all frameworks by: - -1. Navigate to the `webdriver-ts/` directory -2. Run benches: `npm run bench -- --headless --count ` -3. Process results: `npm run results` - -After that, you can check all results in [http://localhost:8080/webdriver-ts/table.html](http://localhost:8080/webdriver-ts/table.html). - -## Tips and tricks - -* You can run multiple frameworks by passing their directory names (cd to webdriver-ts): -`npm run bench keyed/yew-baseline keyed/yew` or if you want to pass more options it becomes: -`npm run bench -- --count 3 keyed/yew`. -* You can run all of the frameworks you've installed using `npm run bench -- --installed` -* To achieve good precision you should run each framework often enough. I recommend at least 10 times, more is better. The result table contains the mean and the standard deviation. You can seen the effect on the latter pretty well if you increase the count. - +where `$CHANGED_YEW_PROJECT` is the path to the root of the yew project you have +your changes in. diff --git a/benchmark_change.sh b/benchmark_change.sh new file mode 100755 index 000000000..bb5ff8667 --- /dev/null +++ b/benchmark_change.sh @@ -0,0 +1,51 @@ +#! /bin/bash +# Usage: ./bechmark_change.sh CHANGE_BRANCH + +http -p 8080 & + +( + set -euo pipefail + + git checkout HEAD -- frameworks/keyed/yew/Cargo.toml + sed -i "s,PATH,$1/packages/yew," frameworks/keyed/yew/Cargo.toml + + npm ci + + ( + set -euo pipefail + cd frameworks/keyed/yew + rm -f Cargo.lock + npm ci + npm run build-prod + ) + ( + set -euo pipefail + cd frameworks/keyed/yew-baseline + rm -f Cargo.lock + npm ci + npm run build-prod + ) + ( + set -euo pipefail + cd webdriver-ts-results + npm ci + ) + ( + set -euo pipefail + cd webdriver-ts + rm -rf results + npm ci + npm run build-prod + npm run bench -- --headless keyed/yew keyed/yew-baseline + npm run results + ) + + if [[ $OSTYPE == 'darwin'* ]]; then + open http://localhost:8080/webdriver-ts-results/table.html & + else + xdg-open http://localhost:8080/webdriver-ts-results/table.html & + fi + sleep 1 +) + +kill %% diff --git a/frameworks/keyed/wasm-bindgen/bundled-dist/1.js b/frameworks/keyed/wasm-bindgen/bundled-dist/1.js deleted file mode 100644 index e1bb375a3..000000000 --- a/frameworks/keyed/wasm-bindgen/bundled-dist/1.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[1],[,function(n,t,e){"use strict";e.r(t);var r=e(3),u=e(2);e.d(t,"main_js",(function(){return u.N})),e.d(t,"__wbindgen_object_drop_ref",(function(){return u.K})),e.d(t,"__wbg_tagName_7a365cf2774b3613",(function(){return u.B})),e.d(t,"__wbg_parentElement_14fd8001596348c2",(function(){return u.s})),e.d(t,"__wbg_getAttribute_937faad6a923ab3c",(function(){return u.j})),e.d(t,"__wbg_random_39c02e3d0f8a020f",(function(){return u.u})),e.d(t,"__wbg_cloneNode_6fbde9e171a9377e",(function(){return u.e})),e.d(t,"__wbg_firstChild_cc345cf09851e11c",(function(){return u.i})),e.d(t,"__wbg_nextSibling_f1e7154ee59f6a7d",(function(){return u.r})),e.d(t,"__wbg_settextContent_917f10f51a06bd14",(function(){return u.A})),e.d(t,"__wbg_setAttribute_1e9980589f904db6",(function(){return u.x})),e.d(t,"__wbg_appendChild_3d4ec7dbf3472d31",(function(){return u.b})),e.d(t,"__wbg_target_f6e8223f5b843ce6",(function(){return u.C})),e.d(t,"__wbg_id_2d7adf535b20f6e9",(function(){return u.n})),e.d(t,"__wbg_preventDefault_df37cc956d4ebefa",(function(){return u.t})),e.d(t,"__wbg_setclassName_f867a8bb05e9072a",(function(){return u.y})),e.d(t,"__wbg_classList_26cad35d60a907de",(function(){return u.d})),e.d(t,"__wbg_contains_6f90cb529cd138a3",(function(){return u.f})),e.d(t,"__wbindgen_object_clone_ref",(function(){return u.J})),e.d(t,"__wbg_insertBefore_e617280513985f61",(function(){return u.o})),e.d(t,"__wbg_remove_00f8ed36a23a14e5",(function(){return u.v})),e.d(t,"__wbg_instanceof_Window_17fdb5cd280d476d",(function(){return u.p})),e.d(t,"__wbg_document_c26d0f423c143e0c",(function(){return u.h})),e.d(t,"__wbg_createElement_44ab59c4ad367831",(function(){return u.g})),e.d(t,"__wbg_setinnerHTML_3eadb06031bae824",(function(){return u.z})),e.d(t,"__wbg_getElementById_df597d226f179219",(function(){return u.k})),e.d(t,"__wbg_addEventListener_0902c64e0479891b",(function(){return u.a})),e.d(t,"__wbindgen_cb_forget",(function(){return u.F})),e.d(t,"__wbindgen_cb_drop",(function(){return u.E})),e.d(t,"__wbg_self_c0d3a5923e013647",(function(){return u.w})),e.d(t,"__wbg_window_7ee6c8be3432927d",(function(){return u.D})),e.d(t,"__wbg_globalThis_c6de1d938e089cf0",(function(){return u.l})),e.d(t,"__wbg_global_c9a01ce4680907f8",(function(){return u.m})),e.d(t,"__wbindgen_is_undefined",(function(){return u.I})),e.d(t,"__wbg_newnoargs_8aad4a6554f38345",(function(){return u.q})),e.d(t,"__wbg_call_1f85aaa5836dfb23",(function(){return u.c})),e.d(t,"__wbindgen_debug_string",(function(){return u.H})),e.d(t,"__wbindgen_throw",(function(){return u.M})),e.d(t,"__wbindgen_rethrow",(function(){return u.L})),e.d(t,"__wbindgen_closure_wrapper64",(function(){return u.G})),r.e()},function(n,t,e){"use strict";(function(n,r){e.d(t,"N",(function(){return v})),e.d(t,"K",(function(){return j})),e.d(t,"B",(function(){return A})),e.d(t,"s",(function(){return T})),e.d(t,"j",(function(){return C})),e.d(t,"u",(function(){return N})),e.d(t,"e",(function(){return k})),e.d(t,"i",(function(){return L})),e.d(t,"r",(function(){return M})),e.d(t,"A",(function(){return B})),e.d(t,"x",(function(){return D})),e.d(t,"b",(function(){return I})),e.d(t,"C",(function(){return S})),e.d(t,"n",(function(){return F})),e.d(t,"t",(function(){return $})),e.d(t,"y",(function(){return J})),e.d(t,"d",(function(){return P})),e.d(t,"f",(function(){return q})),e.d(t,"J",(function(){return H})),e.d(t,"o",(function(){return z})),e.d(t,"v",(function(){return G})),e.d(t,"p",(function(){return K})),e.d(t,"h",(function(){return W})),e.d(t,"g",(function(){return U})),e.d(t,"z",(function(){return Q})),e.d(t,"k",(function(){return R})),e.d(t,"a",(function(){return V})),e.d(t,"F",(function(){return X})),e.d(t,"E",(function(){return Y})),e.d(t,"w",(function(){return Z})),e.d(t,"D",(function(){return nn})),e.d(t,"l",(function(){return tn})),e.d(t,"m",(function(){return en})),e.d(t,"I",(function(){return rn})),e.d(t,"q",(function(){return un})),e.d(t,"c",(function(){return on})),e.d(t,"H",(function(){return cn})),e.d(t,"M",(function(){return fn})),e.d(t,"L",(function(){return dn})),e.d(t,"G",(function(){return _n}));var u=e(3);const o=new Array(32).fill(void 0);function c(n){return o[n]}o.push(void 0,null,!0,!1);let i=o.length;function f(n){const t=c(n);return function(n){n<36||(o[n]=i,i=n)}(n),t}function d(n){i===o.length&&o.push(o.length+1);const t=i;return i=o[t],o[t]=n,t}let _=0,a=null;function l(){return null!==a&&a.buffer===u.g.buffer||(a=new Uint8Array(u.g.buffer)),a}let b=new("undefined"==typeof TextEncoder?(0,n.require)("util").TextEncoder:TextEncoder)("utf-8");const s="function"==typeof b.encodeInto?function(n,t){return b.encodeInto(n,t)}:function(n,t){const e=b.encode(n);return t.set(e),{read:n.length,written:e.length}};function g(n,t,e){if(void 0===e){const e=b.encode(n),r=t(e.length);return l().subarray(r,r+e.length).set(e),_=e.length,r}let r=n.length,u=t(r);const o=l();let c=0;for(;c127)break;o[u+c]=t}if(c!==r){0!==c&&(n=n.slice(c)),u=e(u,r,r=c+3*n.length);const t=l().subarray(u+c,u+r);c+=s(n,t).written}return _=c,u}let w=null;function h(){return null!==w&&w.buffer===u.g.buffer||(w=new Int32Array(u.g.buffer)),w}let p=new("undefined"==typeof TextDecoder?(0,n.require)("util").TextDecoder:TextDecoder)("utf-8",{ignoreBOM:!0,fatal:!0});function y(n,t){return p.decode(l().subarray(n,n+t))}function m(n,t,e){u.h(n,t,d(e))}function v(){u.f()}function x(n){return function(){try{return n.apply(this,arguments)}catch(n){u.a(d(n))}}}function E(n){return null==n}p.decode();const j=function(n){f(n)},A=function(n,t){var e=g(c(t).tagName,u.c,u.d),r=_;h()[n/4+1]=r,h()[n/4+0]=e},T=function(n){var t=c(n).parentElement;return E(t)?0:d(t)},C=function(n,t,e,r){var o=c(t).getAttribute(y(e,r)),i=E(o)?0:g(o,u.c,u.d),f=_;h()[n/4+1]=f,h()[n/4+0]=i},N="function"==typeof Math.random?Math.random:(O="Math.random",()=>{throw new Error(O+" is not defined")});var O;const k=x((function(n,t){return d(c(n).cloneNode(0!==t))})),L=function(n){var t=c(n).firstChild;return E(t)?0:d(t)},M=function(n){var t=c(n).nextSibling;return E(t)?0:d(t)},B=function(n,t,e){c(n).textContent=0===t?void 0:y(t,e)},D=x((function(n,t,e,r,u){c(n).setAttribute(y(t,e),y(r,u))})),I=x((function(n,t){return d(c(n).appendChild(c(t)))})),S=function(n){var t=c(n).target;return E(t)?0:d(t)},F=function(n,t){var e=g(c(t).id,u.c,u.d),r=_;h()[n/4+1]=r,h()[n/4+0]=e},$=function(n){c(n).preventDefault()},J=function(n,t,e){c(n).className=y(t,e)},P=function(n){return d(c(n).classList)},q=function(n,t,e){return c(n).contains(y(t,e))},H=function(n){return d(c(n))},z=x((function(n,t,e){return d(c(n).insertBefore(c(t),c(e)))})),G=function(n){c(n).remove()},K=function(n){return c(n)instanceof Window},W=function(n){var t=c(n).document;return E(t)?0:d(t)},U=x((function(n,t,e){return d(c(n).createElement(y(t,e)))})),Q=function(n,t,e){c(n).innerHTML=y(t,e)},R=function(n,t,e){var r=c(n).getElementById(y(t,e));return E(r)?0:d(r)},V=x((function(n,t,e,r){c(n).addEventListener(y(t,e),c(r))})),X=function(n){f(n)},Y=function(n){const t=f(n).original;if(1==t.cnt--)return t.a=0,!0;return!1},Z=x((function(){return d(self.self)})),nn=x((function(){return d(window.window)})),tn=x((function(){return d(globalThis.globalThis)})),en=x((function(){return d(r.global)})),rn=function(n){return void 0===c(n)},un=function(n,t){return d(new Function(y(n,t)))},on=x((function(n,t){return d(c(n).call(c(t)))})),cn=function(n,t){var e=g(function n(t){const e=typeof t;if("number"==e||"boolean"==e||null==t)return""+t;if("string"==e)return`"${t}"`;if("symbol"==e){const n=t.description;return null==n?"Symbol":`Symbol(${n})`}if("function"==e){const n=t.name;return"string"==typeof n&&n.length>0?`Function(${n})`:"Function"}if(Array.isArray(t)){const e=t.length;let r="[";e>0&&(r+=n(t[0]));for(let u=1;u1))return toString.call(t);if(u=r[1],"Object"==u)try{return"Object("+JSON.stringify(t)+")"}catch(n){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:u}(c(t)),u.c,u.d),r=_;h()[n/4+1]=r,h()[n/4+0]=e},fn=function(n,t){throw new Error(y(n,t))},dn=function(n){throw f(n)},_n=function(n,t,e){return d(function(n,t,e,r){const o={a:n,b:t,cnt:1},c=(...n)=>{o.cnt++;const t=o.a;o.a=0;try{return r(t,o.b,...n)}finally{0==--o.cnt?u.b.get(e)(t,o.b):o.a=t}};return c.original=o,c}(n,t,11,m))}}).call(this,e(4)(n),e(5))},function(n,t,e){"use strict";var r=e.w[n.i];n.exports=r;e(2);r.i()},function(n,t){n.exports=function(n){if(!n.webpackPolyfill){var t=Object.create(n);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(n,t){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(n){"object"==typeof window&&(e=window)}n.exports=e}]]); \ No newline at end of file diff --git a/frameworks/keyed/wasm-bindgen/bundled-dist/57b853b60f01dd1d4d7e.module.wasm b/frameworks/keyed/wasm-bindgen/bundled-dist/57b853b60f01dd1d4d7e.module.wasm deleted file mode 100644 index d634f0e51..000000000 Binary files a/frameworks/keyed/wasm-bindgen/bundled-dist/57b853b60f01dd1d4d7e.module.wasm and /dev/null differ diff --git a/frameworks/keyed/wasm-bindgen/bundled-dist/index.js b/frameworks/keyed/wasm-bindgen/bundled-dist/index.js deleted file mode 100644 index 91844088c..000000000 --- a/frameworks/keyed/wasm-bindgen/bundled-dist/index.js +++ /dev/null @@ -1 +0,0 @@ -!function(e){function n(n){for(var t,o,u=n[0],_=n[1],i=0,c=[];i 0) { - return `Function(${name})`; - } else { - return 'Function'; - } - } - // objects - if (Array.isArray(val)) { - const length = val.length; - let debug = '['; - if (length > 0) { - debug += debugString(val[0]); - } - for(let i = 1; i < length; i++) { - debug += ', ' + debugString(val[i]); - } - debug += ']'; - return debug; - } - // Test for built-in - const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); - let className; - if (builtInMatches.length > 1) { - className = builtInMatches[1]; - } else { - // Failed to match the standard '[object ClassName]' - return toString.call(val); - } - if (className == 'Object') { - // we're a user defined class or Object - // JSON.stringify avoids problems with cycles, and is generally much - // easier than looping through ownProperties of `val`. - try { - return 'Object(' + JSON.stringify(val) + ')'; - } catch (_) { - return 'Object'; - } - } - // errors - if (val instanceof Error) { - return `${val.name}: ${val.message}\n${val.stack}`; - } - // TODO we could test for more things here, like `Set`s and `Map`s. - return className; -} - -let WASM_VECTOR_LEN = 0; - -let cachegetUint8Memory0 = null; -function getUint8Memory0() { - if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { - cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); - } - return cachegetUint8Memory0; -} - -let cachedTextEncoder = new TextEncoder('utf-8'); - -const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' - ? function (arg, view) { - return cachedTextEncoder.encodeInto(arg, view); -} - : function (arg, view) { - const buf = cachedTextEncoder.encode(arg); - view.set(buf); - return { - read: arg.length, - written: buf.length - }; -}); - -function passStringToWasm0(arg, malloc, realloc) { - - if (realloc === undefined) { - const buf = cachedTextEncoder.encode(arg); - const ptr = malloc(buf.length); - getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); - WASM_VECTOR_LEN = buf.length; - return ptr; - } - - let len = arg.length; - let ptr = malloc(len); - - const mem = getUint8Memory0(); - - let offset = 0; - - for (; offset < len; offset++) { - const code = arg.charCodeAt(offset); - if (code > 0x7F) break; - mem[ptr + offset] = code; - } - - if (offset !== len) { - if (offset !== 0) { - arg = arg.slice(offset); - } - ptr = realloc(ptr, len, len = offset + arg.length * 3); - const view = getUint8Memory0().subarray(ptr + offset, ptr + len); - const ret = encodeString(arg, view); - - offset += ret.written; - } - - WASM_VECTOR_LEN = offset; - return ptr; -} - -let cachegetInt32Memory0 = null; -function getInt32Memory0() { - if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { - cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); - } - return cachegetInt32Memory0; -} - -let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -function getStringFromWasm0(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); -} - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - -function makeMutClosure(arg0, arg1, dtor, f) { - const state = { a: arg0, b: arg1, cnt: 1 }; - const real = (...args) => { - // First up with a closure we increment the internal reference - // count. This ensures that the Rust closure environment won't - // be deallocated while we're invoking it. - state.cnt++; - const a = state.a; - state.a = 0; - try { - return f(a, state.b, ...args); - } finally { - if (--state.cnt === 0) wasm.__wbindgen_export_2.get(dtor)(a, state.b); - else state.a = a; - } - }; - real.original = state; - return real; -} - -let stack_pointer = 32; - -function addBorrowedObject(obj) { - if (stack_pointer == 1) throw new Error('out of js stack'); - heap[--stack_pointer] = obj; - return stack_pointer; -} -function __wbg_adapter_16(arg0, arg1, arg2) { - try { - wasm.wasm_bindgen__convert__closures__invoke1_mut_ref__hcd644a1bc0bc2463(arg0, arg1, addBorrowedObject(arg2)); - } finally { - heap[stack_pointer++] = undefined; - } -} - -/** -*/ -export function start() { - wasm.start(); -} - -function handleError(f) { - return function () { - try { - return f.apply(this, arguments); - - } catch (e) { - wasm.__wbindgen_exn_store(addHeapObject(e)); - } - }; -} - -function getArrayU8FromWasm0(ptr, len) { - return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); -} - -function isLikeNone(x) { - return x === undefined || x === null; -} - -async function load(module, imports) { - if (typeof Response === 'function' && module instanceof Response) { - - if (typeof WebAssembly.instantiateStreaming === 'function') { - try { - return await WebAssembly.instantiateStreaming(module, imports); - - } catch (e) { - if (module.headers.get('Content-Type') != 'application/wasm') { - console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - - } else { - throw e; - } - } - } - - const bytes = await module.arrayBuffer(); - return await WebAssembly.instantiate(bytes, imports); - - } else { - - const instance = await WebAssembly.instantiate(module, imports); - - if (instance instanceof WebAssembly.Instance) { - return { instance, module }; - - } else { - return instance; - } - } -} - -async function init(input) { - if (typeof input === 'undefined') { - input = import.meta.url.replace(/\.js$/, '_bg.wasm'); - } - const imports = {}; - imports.wbg = {}; - imports.wbg.__wbindgen_object_drop_ref = function(arg0) { - takeObject(arg0); - }; - imports.wbg.__wbg_removeEventListener_003b13762a00969d = handleError(function(arg0, arg1, arg2, arg3, arg4) { - getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), arg4 !== 0); - }); - imports.wbg.__wbindgen_cb_drop = function(arg0) { - const obj = takeObject(arg0).original; - if (obj.cnt-- == 1) { - obj.a = 0; - return true; - } - var ret = false; - return ret; - }; - imports.wbg.__wbg_self_1b7a39e3a92c949c = handleError(function() { - var ret = self.self; - return addHeapObject(ret); - }); - imports.wbg.__wbg_require_604837428532a733 = function(arg0, arg1) { - var ret = require(getStringFromWasm0(arg0, arg1)); - return addHeapObject(ret); - }; - imports.wbg.__wbg_crypto_968f1772287e2df0 = function(arg0) { - var ret = getObject(arg0).crypto; - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_is_undefined = function(arg0) { - var ret = getObject(arg0) === undefined; - return ret; - }; - imports.wbg.__wbg_getRandomValues_a3d34b4fee3c2869 = function(arg0) { - var ret = getObject(arg0).getRandomValues; - return addHeapObject(ret); - }; - imports.wbg.__wbg_randomFillSync_d5bd2d655fdf256a = function(arg0, arg1, arg2) { - getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2)); - }; - imports.wbg.__wbg_getRandomValues_f5e14ab7ac8e995d = function(arg0, arg1, arg2) { - getObject(arg0).getRandomValues(getArrayU8FromWasm0(arg1, arg2)); - }; - imports.wbg.__wbg_document_c26d0f423c143e0c = function(arg0) { - var ret = getObject(arg0).document; - return isLikeNone(ret) ? 0 : addHeapObject(ret); - }; - imports.wbg.__wbg_querySelector_9cf023db23245913 = handleError(function(arg0, arg1, arg2) { - var ret = getObject(arg0).querySelector(getStringFromWasm0(arg1, arg2)); - return isLikeNone(ret) ? 0 : addHeapObject(ret); - }); - imports.wbg.__wbg_lastChild_4add591e64b65966 = function(arg0) { - var ret = getObject(arg0).lastChild; - return isLikeNone(ret) ? 0 : addHeapObject(ret); - }; - imports.wbg.__wbg_removeChild_d8035999cf171601 = handleError(function(arg0, arg1) { - var ret = getObject(arg0).removeChild(getObject(arg1)); - return addHeapObject(ret); - }); - imports.wbg.__wbindgen_debug_string = function(arg0, arg1) { - var ret = debugString(getObject(arg1)); - var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - var len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }; - imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); - }; - imports.wbg.__wbg_self_c0d3a5923e013647 = handleError(function() { - var ret = self.self; - return addHeapObject(ret); - }); - imports.wbg.__wbg_window_7ee6c8be3432927d = handleError(function() { - var ret = window.window; - return addHeapObject(ret); - }); - imports.wbg.__wbg_globalThis_c6de1d938e089cf0 = handleError(function() { - var ret = globalThis.globalThis; - return addHeapObject(ret); - }); - imports.wbg.__wbg_global_c9a01ce4680907f8 = handleError(function() { - var ret = global.global; - return addHeapObject(ret); - }); - imports.wbg.__wbg_newnoargs_8aad4a6554f38345 = function(arg0, arg1) { - var ret = new Function(getStringFromWasm0(arg0, arg1)); - return addHeapObject(ret); - }; - imports.wbg.__wbg_call_1f85aaa5836dfb23 = handleError(function(arg0, arg1) { - var ret = getObject(arg0).call(getObject(arg1)); - return addHeapObject(ret); - }); - imports.wbg.__wbindgen_object_clone_ref = function(arg0) { - var ret = getObject(arg0); - return addHeapObject(ret); - }; - imports.wbg.__wbg_instanceof_Window_17fdb5cd280d476d = function(arg0) { - var ret = getObject(arg0) instanceof Window; - return ret; - }; - imports.wbg.__wbg_appendChild_3d4ec7dbf3472d31 = handleError(function(arg0, arg1) { - var ret = getObject(arg0).appendChild(getObject(arg1)); - return addHeapObject(ret); - }); - imports.wbg.__wbg_insertBefore_e617280513985f61 = handleError(function(arg0, arg1, arg2) { - var ret = getObject(arg0).insertBefore(getObject(arg1), getObject(arg2)); - return addHeapObject(ret); - }); - imports.wbg.__wbg_instanceof_HtmlInputElement_9e9349535b986dc4 = function(arg0) { - var ret = getObject(arg0) instanceof HTMLInputElement; - return ret; - }; - imports.wbg.__wbg_value_c2fd875fedc14f57 = function(arg0, arg1) { - var ret = getObject(arg1).value; - var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - var len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }; - imports.wbg.__wbg_instanceof_HtmlTextAreaElement_af4dc0571f10534b = function(arg0) { - var ret = getObject(arg0) instanceof HTMLTextAreaElement; - return ret; - }; - imports.wbg.__wbg_value_7ffe1d058e13aa75 = function(arg0, arg1) { - var ret = getObject(arg1).value; - var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - var len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }; - imports.wbg.__wbg_createTextNode_756ffaca4044be42 = function(arg0, arg1, arg2) { - var ret = getObject(arg0).createTextNode(getStringFromWasm0(arg1, arg2)); - return addHeapObject(ret); - }; - imports.wbg.__wbg_setnodeValue_ab4d09a5c9b583a3 = function(arg0, arg1, arg2) { - getObject(arg0).nodeValue = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_is_44606c0a00d7753b = function(arg0, arg1) { - var ret = Object.is(getObject(arg0), getObject(arg1)); - return ret; - }; - imports.wbg.__wbg_setAttribute_1e9980589f904db6 = handleError(function(arg0, arg1, arg2, arg3, arg4) { - getObject(arg0).setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); - }); - imports.wbg.__wbg_removeAttribute_ab1ad95ea7761680 = handleError(function(arg0, arg1, arg2) { - getObject(arg0).removeAttribute(getStringFromWasm0(arg1, arg2)); - }); - imports.wbg.__wbg_instanceof_HtmlButtonElement_0c660cd977827d1e = function(arg0) { - var ret = getObject(arg0) instanceof HTMLButtonElement; - return ret; - }; - imports.wbg.__wbg_settype_8b416ca7e828acb0 = function(arg0, arg1, arg2) { - getObject(arg0).type = getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_settype_ccacb981913395e5 = function(arg0, arg1, arg2) { - getObject(arg0).type = getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_setvalue_eb5415236467cd34 = function(arg0, arg1, arg2) { - getObject(arg0).value = getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_setchecked_795fe0b967d5d996 = function(arg0, arg1) { - getObject(arg0).checked = arg1 !== 0; - }; - imports.wbg.__wbg_setvalue_8bb8ffbd27a7ffda = function(arg0, arg1, arg2) { - getObject(arg0).value = getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_namespaceURI_35b1c4eab9150629 = function(arg0, arg1) { - var ret = getObject(arg1).namespaceURI; - var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - var len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }; - imports.wbg.__wbg_createElement_44ab59c4ad367831 = handleError(function(arg0, arg1, arg2) { - var ret = getObject(arg0).createElement(getStringFromWasm0(arg1, arg2)); - return addHeapObject(ret); - }); - imports.wbg.__wbg_createElementNS_74ac818c77233fe4 = handleError(function(arg0, arg1, arg2, arg3, arg4) { - var ret = getObject(arg0).createElementNS(arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); - return addHeapObject(ret); - }); - imports.wbg.__wbg_new_d6227c3c833572bb = function() { - var ret = new Object(); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_string_new = function(arg0, arg1) { - var ret = getStringFromWasm0(arg0, arg1); - return addHeapObject(ret); - }; - imports.wbg.__wbg_set_6a666216929b0387 = handleError(function(arg0, arg1, arg2) { - var ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2)); - return ret; - }); - imports.wbg.__wbg_addEventListener_3526086a053a131e = handleError(function(arg0, arg1, arg2, arg3, arg4) { - getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), getObject(arg4)); - }); - imports.wbg.__wbindgen_closure_wrapper1301 = function(arg0, arg1, arg2) { - var ret = makeMutClosure(arg0, arg1, 27, __wbg_adapter_16); - return addHeapObject(ret); - }; - - if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { - input = fetch(input); - } - - const { instance, module } = await load(await input, imports); - - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - wasm.__wbindgen_start(); - return wasm; -} - -export default init; - diff --git a/frameworks/keyed/yew-baseline/bundled-dist/js-framework-benchmark-yew_bg.wasm b/frameworks/keyed/yew-baseline/bundled-dist/js-framework-benchmark-yew_bg.wasm deleted file mode 100644 index 304887097..000000000 Binary files a/frameworks/keyed/yew-baseline/bundled-dist/js-framework-benchmark-yew_bg.wasm and /dev/null differ diff --git a/frameworks/keyed/yew-baseline/package.json b/frameworks/keyed/yew-baseline/package.json index 2fa0702aa..b30402857 100644 --- a/frameworks/keyed/yew-baseline/package.json +++ b/frameworks/keyed/yew-baseline/package.json @@ -4,7 +4,7 @@ "description": "Benchmark for Yew", "license": "ISC", "js-framework-benchmark": { - "frameworkVersion": "0.16.2" + "frameworkVersion": "master" }, "scripts": { "build-dev": "rimraf bundled-dist && wasm-pack build --dev --target web --no-typescript --out-name js-framework-benchmark-yew --out-dir bundled-dist && cpr index.html bundled-dist/index.html && (cd bundled-dist && rimraf .gitignore README.md package.json)", @@ -15,7 +15,7 @@ "url": "https://github.com/krausest/js-framework-benchmark.git" }, "devDependencies": { - "rimraf": "^2.6.3", - "cpr": "^3.0.1" + "cpr": "^3.0.1", + "rimraf": "^2.6.3" } } diff --git a/frameworks/keyed/yew-baseline/src/lib.rs b/frameworks/keyed/yew-baseline/src/lib.rs index 57edd4f40..05f38a2ca 100644 --- a/frameworks/keyed/yew-baseline/src/lib.rs +++ b/frameworks/keyed/yew-baseline/src/lib.rs @@ -4,7 +4,7 @@ use rand::prelude::*; use std::cmp::min; use wasm_bindgen::prelude::wasm_bindgen; use yew::prelude::*; -use yew::web_sys::window; +use yew::{html::Scope, web_sys::window}; static ADJECTIVES: &[&str] = &[ "pretty", @@ -68,7 +68,6 @@ struct Model { next_id: usize, selected_id: Option, rng: SmallRng, - link: ComponentLink, on_select: Callback, on_remove: Callback, } @@ -87,23 +86,18 @@ impl Component for Model { type Message = Msg; type Properties = (); - fn create(_: Self::Properties, link: ComponentLink) -> Self { + fn create(ctx: &Context) -> Self { Model { rows: Vec::new(), next_id: 1, selected_id: None, rng: SmallRng::from_entropy(), - on_select: link.callback(|id| Msg::Select(id)), - on_remove: link.callback(|id| Msg::Remove(id)), - link, + on_select: ctx.link().callback(|id| Msg::Select(id)), + on_remove: ctx.link().callback(|id| Msg::Remove(id)), } } - fn change(&mut self, _: ()) -> ShouldRender { - false - } - - fn update(&mut self, msg: Self::Message) -> ShouldRender { + fn update(&mut self, _: &Context, msg: Self::Message) -> bool { match msg { Msg::Run(amount) => { let rng = &mut self.rng; @@ -149,24 +143,24 @@ impl Component for Model { true } - fn view(&self) -> Html { + fn view(&self, ctx: &Context) -> Html { let rows: Html = self .rows .iter() .map(|row| { html! { - + } }) .collect(); html! {
- + { rows } @@ -180,30 +174,29 @@ impl Component for Model { #[derive(Properties, Clone)] struct JumbotronProps { - link: ComponentLink, + link: Scope, } -struct Jumbotron { - link: ComponentLink, +impl PartialEq for JumbotronProps { + fn eq(&self, _: &Self) -> bool { + // Never changed + true + } } +impl Eq for JumbotronProps {} + +struct Jumbotron; + impl Component for Jumbotron { type Properties = JumbotronProps; type Message = (); - fn create(props: Self::Properties, _: ComponentLink) -> Self { - Self { link: props.link } - } - - fn change(&mut self, _: Self::Properties) -> ShouldRender { - false - } - - fn update(&mut self, _: Self::Message) -> ShouldRender { - false + fn create(_: &Context) -> Self { + Self } - fn view(&self) -> Html { + fn view(&self, ctx: &Context) -> Html { html! {
@@ -213,22 +206,22 @@ impl Component for Jumbotron {
- +
- +
- +
- +
- +
- +
@@ -253,7 +246,6 @@ struct RowState { struct Row { state: RowState, - props: RowProps, } impl RowState { @@ -270,36 +262,26 @@ impl Component for Row { type Message = (); type Properties = RowProps; - fn create(props: Self::Properties, _: ComponentLink) -> Self { + fn create(ctx: &Context) -> Self { Self { - state: RowState::from_props(&props), - props, + state: RowState::from_props(ctx.props()), } } - fn change(&mut self, props: RowProps) -> ShouldRender { - if self.props != props { - self.state = RowState::from_props(&props); - self.props = props; - true - } else { - false - } - } - - fn update(&mut self, _: ()) -> ShouldRender { - false + fn changed(&mut self, ctx: &Context) -> bool { + self.state = RowState::from_props(ctx.props()); + true } - fn view(&self) -> Html { + fn view(&self, ctx: &Context) -> Html { html! { -
- - + + @@ -313,5 +295,5 @@ impl Component for Row { pub fn start() { let document = window().unwrap().document().unwrap(); let mount_el = document.query_selector("#main").unwrap().unwrap(); - App::::new().mount(mount_el); + yew::start_app_in_element::(mount_el); } diff --git a/frameworks/keyed/yew/Cargo.toml b/frameworks/keyed/yew/Cargo.toml index e18ac269b..d3f1922bb 100644 --- a/frameworks/keyed/yew/Cargo.toml +++ b/frameworks/keyed/yew/Cargo.toml @@ -1,23 +1,23 @@ [package] -name = "js-framework-benchmark-yew" -version = "1.0.0" authors = ["Isamu Mogi "] edition = "2018" +name = "js-framework-benchmark-yew" +version = "1.0.0" [lib] crate-type = ["cdylib"] [dependencies] -rand = { version = "0.7.3", features = ["wasm-bindgen", "small_rng"] } +rand = {version = "0.7.3", features = ["wasm-bindgen", "small_rng"]} wasm-bindgen = "0.2.62" # UPDATE TO USE YOUR BRANCH -yew = { git = "https://github.com/yewstack/yew", branch = "master" } +yew = {path = "PATH"} # UPDATE TO USE YOUR BRANCH [profile.release] -lto = true codegen-units = 1 +lto = true panic = "abort" [package.metadata.wasm-pack.profile.release] diff --git a/frameworks/keyed/yew/bundled-dist/index.html b/frameworks/keyed/yew/bundled-dist/index.html deleted file mode 100644 index 7f4868a86..000000000 --- a/frameworks/keyed/yew/bundled-dist/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - Yew - - - - -
- - - diff --git a/frameworks/keyed/yew/bundled-dist/js-framework-benchmark-yew.js b/frameworks/keyed/yew/bundled-dist/js-framework-benchmark-yew.js deleted file mode 100644 index 759dec650..000000000 --- a/frameworks/keyed/yew/bundled-dist/js-framework-benchmark-yew.js +++ /dev/null @@ -1,489 +0,0 @@ - -let wasm; - -const heap = new Array(32).fill(undefined); - -heap.push(undefined, null, true, false); - -function getObject(idx) { return heap[idx]; } - -let heap_next = heap.length; - -function dropObject(idx) { - if (idx < 36) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - -function debugString(val) { - // primitive types - const type = typeof val; - if (type == 'number' || type == 'boolean' || val == null) { - return `${val}`; - } - if (type == 'string') { - return `"${val}"`; - } - if (type == 'symbol') { - const description = val.description; - if (description == null) { - return 'Symbol'; - } else { - return `Symbol(${description})`; - } - } - if (type == 'function') { - const name = val.name; - if (typeof name == 'string' && name.length > 0) { - return `Function(${name})`; - } else { - return 'Function'; - } - } - // objects - if (Array.isArray(val)) { - const length = val.length; - let debug = '['; - if (length > 0) { - debug += debugString(val[0]); - } - for(let i = 1; i < length; i++) { - debug += ', ' + debugString(val[i]); - } - debug += ']'; - return debug; - } - // Test for built-in - const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); - let className; - if (builtInMatches.length > 1) { - className = builtInMatches[1]; - } else { - // Failed to match the standard '[object ClassName]' - return toString.call(val); - } - if (className == 'Object') { - // we're a user defined class or Object - // JSON.stringify avoids problems with cycles, and is generally much - // easier than looping through ownProperties of `val`. - try { - return 'Object(' + JSON.stringify(val) + ')'; - } catch (_) { - return 'Object'; - } - } - // errors - if (val instanceof Error) { - return `${val.name}: ${val.message}\n${val.stack}`; - } - // TODO we could test for more things here, like `Set`s and `Map`s. - return className; -} - -let WASM_VECTOR_LEN = 0; - -let cachegetUint8Memory0 = null; -function getUint8Memory0() { - if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { - cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); - } - return cachegetUint8Memory0; -} - -let cachedTextEncoder = new TextEncoder('utf-8'); - -const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' - ? function (arg, view) { - return cachedTextEncoder.encodeInto(arg, view); -} - : function (arg, view) { - const buf = cachedTextEncoder.encode(arg); - view.set(buf); - return { - read: arg.length, - written: buf.length - }; -}); - -function passStringToWasm0(arg, malloc, realloc) { - - if (realloc === undefined) { - const buf = cachedTextEncoder.encode(arg); - const ptr = malloc(buf.length); - getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); - WASM_VECTOR_LEN = buf.length; - return ptr; - } - - let len = arg.length; - let ptr = malloc(len); - - const mem = getUint8Memory0(); - - let offset = 0; - - for (; offset < len; offset++) { - const code = arg.charCodeAt(offset); - if (code > 0x7F) break; - mem[ptr + offset] = code; - } - - if (offset !== len) { - if (offset !== 0) { - arg = arg.slice(offset); - } - ptr = realloc(ptr, len, len = offset + arg.length * 3); - const view = getUint8Memory0().subarray(ptr + offset, ptr + len); - const ret = encodeString(arg, view); - - offset += ret.written; - } - - WASM_VECTOR_LEN = offset; - return ptr; -} - -let cachegetInt32Memory0 = null; -function getInt32Memory0() { - if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { - cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); - } - return cachegetInt32Memory0; -} - -let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -function getStringFromWasm0(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); -} - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - -function makeMutClosure(arg0, arg1, dtor, f) { - const state = { a: arg0, b: arg1, cnt: 1 }; - const real = (...args) => { - // First up with a closure we increment the internal reference - // count. This ensures that the Rust closure environment won't - // be deallocated while we're invoking it. - state.cnt++; - const a = state.a; - state.a = 0; - try { - return f(a, state.b, ...args); - } finally { - if (--state.cnt === 0) wasm.__wbindgen_export_2.get(dtor)(a, state.b); - else state.a = a; - } - }; - real.original = state; - return real; -} - -let stack_pointer = 32; - -function addBorrowedObject(obj) { - if (stack_pointer == 1) throw new Error('out of js stack'); - heap[--stack_pointer] = obj; - return stack_pointer; -} -function __wbg_adapter_16(arg0, arg1, arg2) { - try { - wasm.wasm_bindgen__convert__closures__invoke1_mut_ref__h2644d8b2cde4a809(arg0, arg1, addBorrowedObject(arg2)); - } finally { - heap[stack_pointer++] = undefined; - } -} - -/** -*/ -export function start() { - wasm.start(); -} - -function handleError(f) { - return function () { - try { - return f.apply(this, arguments); - - } catch (e) { - wasm.__wbindgen_exn_store(addHeapObject(e)); - } - }; -} - -function getArrayU8FromWasm0(ptr, len) { - return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); -} - -function isLikeNone(x) { - return x === undefined || x === null; -} - -async function load(module, imports) { - if (typeof Response === 'function' && module instanceof Response) { - - if (typeof WebAssembly.instantiateStreaming === 'function') { - try { - return await WebAssembly.instantiateStreaming(module, imports); - - } catch (e) { - if (module.headers.get('Content-Type') != 'application/wasm') { - console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - - } else { - throw e; - } - } - } - - const bytes = await module.arrayBuffer(); - return await WebAssembly.instantiate(bytes, imports); - - } else { - - const instance = await WebAssembly.instantiate(module, imports); - - if (instance instanceof WebAssembly.Instance) { - return { instance, module }; - - } else { - return instance; - } - } -} - -async function init(input) { - if (typeof input === 'undefined') { - input = import.meta.url.replace(/\.js$/, '_bg.wasm'); - } - const imports = {}; - imports.wbg = {}; - imports.wbg.__wbindgen_object_drop_ref = function(arg0) { - takeObject(arg0); - }; - imports.wbg.__wbg_removeEventListener_003b13762a00969d = handleError(function(arg0, arg1, arg2, arg3, arg4) { - getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), arg4 !== 0); - }); - imports.wbg.__wbindgen_cb_drop = function(arg0) { - const obj = takeObject(arg0).original; - if (obj.cnt-- == 1) { - obj.a = 0; - return true; - } - var ret = false; - return ret; - }; - imports.wbg.__wbg_self_1b7a39e3a92c949c = handleError(function() { - var ret = self.self; - return addHeapObject(ret); - }); - imports.wbg.__wbg_require_604837428532a733 = function(arg0, arg1) { - var ret = require(getStringFromWasm0(arg0, arg1)); - return addHeapObject(ret); - }; - imports.wbg.__wbg_crypto_968f1772287e2df0 = function(arg0) { - var ret = getObject(arg0).crypto; - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_is_undefined = function(arg0) { - var ret = getObject(arg0) === undefined; - return ret; - }; - imports.wbg.__wbg_getRandomValues_a3d34b4fee3c2869 = function(arg0) { - var ret = getObject(arg0).getRandomValues; - return addHeapObject(ret); - }; - imports.wbg.__wbg_randomFillSync_d5bd2d655fdf256a = function(arg0, arg1, arg2) { - getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2)); - }; - imports.wbg.__wbg_getRandomValues_f5e14ab7ac8e995d = function(arg0, arg1, arg2) { - getObject(arg0).getRandomValues(getArrayU8FromWasm0(arg1, arg2)); - }; - imports.wbg.__wbg_document_c26d0f423c143e0c = function(arg0) { - var ret = getObject(arg0).document; - return isLikeNone(ret) ? 0 : addHeapObject(ret); - }; - imports.wbg.__wbg_querySelector_9cf023db23245913 = handleError(function(arg0, arg1, arg2) { - var ret = getObject(arg0).querySelector(getStringFromWasm0(arg1, arg2)); - return isLikeNone(ret) ? 0 : addHeapObject(ret); - }); - imports.wbg.__wbg_lastChild_4add591e64b65966 = function(arg0) { - var ret = getObject(arg0).lastChild; - return isLikeNone(ret) ? 0 : addHeapObject(ret); - }; - imports.wbg.__wbg_removeChild_d8035999cf171601 = handleError(function(arg0, arg1) { - var ret = getObject(arg0).removeChild(getObject(arg1)); - return addHeapObject(ret); - }); - imports.wbg.__wbindgen_debug_string = function(arg0, arg1) { - var ret = debugString(getObject(arg1)); - var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - var len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }; - imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); - }; - imports.wbg.__wbg_self_c0d3a5923e013647 = handleError(function() { - var ret = self.self; - return addHeapObject(ret); - }); - imports.wbg.__wbg_window_7ee6c8be3432927d = handleError(function() { - var ret = window.window; - return addHeapObject(ret); - }); - imports.wbg.__wbg_globalThis_c6de1d938e089cf0 = handleError(function() { - var ret = globalThis.globalThis; - return addHeapObject(ret); - }); - imports.wbg.__wbg_global_c9a01ce4680907f8 = handleError(function() { - var ret = global.global; - return addHeapObject(ret); - }); - imports.wbg.__wbg_newnoargs_8aad4a6554f38345 = function(arg0, arg1) { - var ret = new Function(getStringFromWasm0(arg0, arg1)); - return addHeapObject(ret); - }; - imports.wbg.__wbg_call_1f85aaa5836dfb23 = handleError(function(arg0, arg1) { - var ret = getObject(arg0).call(getObject(arg1)); - return addHeapObject(ret); - }); - imports.wbg.__wbindgen_object_clone_ref = function(arg0) { - var ret = getObject(arg0); - return addHeapObject(ret); - }; - imports.wbg.__wbg_instanceof_Window_17fdb5cd280d476d = function(arg0) { - var ret = getObject(arg0) instanceof Window; - return ret; - }; - imports.wbg.__wbg_appendChild_3d4ec7dbf3472d31 = handleError(function(arg0, arg1) { - var ret = getObject(arg0).appendChild(getObject(arg1)); - return addHeapObject(ret); - }); - imports.wbg.__wbg_insertBefore_e617280513985f61 = handleError(function(arg0, arg1, arg2) { - var ret = getObject(arg0).insertBefore(getObject(arg1), getObject(arg2)); - return addHeapObject(ret); - }); - imports.wbg.__wbg_instanceof_HtmlInputElement_9e9349535b986dc4 = function(arg0) { - var ret = getObject(arg0) instanceof HTMLInputElement; - return ret; - }; - imports.wbg.__wbg_value_c2fd875fedc14f57 = function(arg0, arg1) { - var ret = getObject(arg1).value; - var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - var len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }; - imports.wbg.__wbg_instanceof_HtmlTextAreaElement_af4dc0571f10534b = function(arg0) { - var ret = getObject(arg0) instanceof HTMLTextAreaElement; - return ret; - }; - imports.wbg.__wbg_value_7ffe1d058e13aa75 = function(arg0, arg1) { - var ret = getObject(arg1).value; - var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - var len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }; - imports.wbg.__wbg_createTextNode_756ffaca4044be42 = function(arg0, arg1, arg2) { - var ret = getObject(arg0).createTextNode(getStringFromWasm0(arg1, arg2)); - return addHeapObject(ret); - }; - imports.wbg.__wbg_setnodeValue_ab4d09a5c9b583a3 = function(arg0, arg1, arg2) { - getObject(arg0).nodeValue = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_is_44606c0a00d7753b = function(arg0, arg1) { - var ret = Object.is(getObject(arg0), getObject(arg1)); - return ret; - }; - imports.wbg.__wbg_setAttribute_1e9980589f904db6 = handleError(function(arg0, arg1, arg2, arg3, arg4) { - getObject(arg0).setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); - }); - imports.wbg.__wbg_removeAttribute_ab1ad95ea7761680 = handleError(function(arg0, arg1, arg2) { - getObject(arg0).removeAttribute(getStringFromWasm0(arg1, arg2)); - }); - imports.wbg.__wbg_instanceof_HtmlButtonElement_0c660cd977827d1e = function(arg0) { - var ret = getObject(arg0) instanceof HTMLButtonElement; - return ret; - }; - imports.wbg.__wbg_settype_8b416ca7e828acb0 = function(arg0, arg1, arg2) { - getObject(arg0).type = getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_settype_ccacb981913395e5 = function(arg0, arg1, arg2) { - getObject(arg0).type = getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_setvalue_eb5415236467cd34 = function(arg0, arg1, arg2) { - getObject(arg0).value = getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_setchecked_795fe0b967d5d996 = function(arg0, arg1) { - getObject(arg0).checked = arg1 !== 0; - }; - imports.wbg.__wbg_setvalue_8bb8ffbd27a7ffda = function(arg0, arg1, arg2) { - getObject(arg0).value = getStringFromWasm0(arg1, arg2); - }; - imports.wbg.__wbg_namespaceURI_35b1c4eab9150629 = function(arg0, arg1) { - var ret = getObject(arg1).namespaceURI; - var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); - var len0 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len0; - getInt32Memory0()[arg0 / 4 + 0] = ptr0; - }; - imports.wbg.__wbg_createElement_44ab59c4ad367831 = handleError(function(arg0, arg1, arg2) { - var ret = getObject(arg0).createElement(getStringFromWasm0(arg1, arg2)); - return addHeapObject(ret); - }); - imports.wbg.__wbg_createElementNS_74ac818c77233fe4 = handleError(function(arg0, arg1, arg2, arg3, arg4) { - var ret = getObject(arg0).createElementNS(arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); - return addHeapObject(ret); - }); - imports.wbg.__wbg_new_d6227c3c833572bb = function() { - var ret = new Object(); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_string_new = function(arg0, arg1) { - var ret = getStringFromWasm0(arg0, arg1); - return addHeapObject(ret); - }; - imports.wbg.__wbg_set_6a666216929b0387 = handleError(function(arg0, arg1, arg2) { - var ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2)); - return ret; - }); - imports.wbg.__wbg_addEventListener_3526086a053a131e = handleError(function(arg0, arg1, arg2, arg3, arg4) { - getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), getObject(arg4)); - }); - imports.wbg.__wbindgen_closure_wrapper1301 = function(arg0, arg1, arg2) { - var ret = makeMutClosure(arg0, arg1, 27, __wbg_adapter_16); - return addHeapObject(ret); - }; - - if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { - input = fetch(input); - } - - const { instance, module } = await load(await input, imports); - - wasm = instance.exports; - init.__wbindgen_wasm_module = module; - wasm.__wbindgen_start(); - return wasm; -} - -export default init; - diff --git a/frameworks/keyed/yew/bundled-dist/js-framework-benchmark-yew_bg.wasm b/frameworks/keyed/yew/bundled-dist/js-framework-benchmark-yew_bg.wasm deleted file mode 100644 index 4420050b7..000000000 Binary files a/frameworks/keyed/yew/bundled-dist/js-framework-benchmark-yew_bg.wasm and /dev/null differ diff --git a/frameworks/keyed/yew/package.json b/frameworks/keyed/yew/package.json index 2fa0702aa..22fda1137 100644 --- a/frameworks/keyed/yew/package.json +++ b/frameworks/keyed/yew/package.json @@ -4,7 +4,7 @@ "description": "Benchmark for Yew", "license": "ISC", "js-framework-benchmark": { - "frameworkVersion": "0.16.2" + "frameworkVersion": "local" }, "scripts": { "build-dev": "rimraf bundled-dist && wasm-pack build --dev --target web --no-typescript --out-name js-framework-benchmark-yew --out-dir bundled-dist && cpr index.html bundled-dist/index.html && (cd bundled-dist && rimraf .gitignore README.md package.json)", @@ -15,7 +15,7 @@ "url": "https://github.com/krausest/js-framework-benchmark.git" }, "devDependencies": { - "rimraf": "^2.6.3", - "cpr": "^3.0.1" + "cpr": "^3.0.1", + "rimraf": "^2.6.3" } } diff --git a/frameworks/keyed/yew/src/lib.rs b/frameworks/keyed/yew/src/lib.rs index 57edd4f40..05f38a2ca 100644 --- a/frameworks/keyed/yew/src/lib.rs +++ b/frameworks/keyed/yew/src/lib.rs @@ -4,7 +4,7 @@ use rand::prelude::*; use std::cmp::min; use wasm_bindgen::prelude::wasm_bindgen; use yew::prelude::*; -use yew::web_sys::window; +use yew::{html::Scope, web_sys::window}; static ADJECTIVES: &[&str] = &[ "pretty", @@ -68,7 +68,6 @@ struct Model { next_id: usize, selected_id: Option, rng: SmallRng, - link: ComponentLink, on_select: Callback, on_remove: Callback, } @@ -87,23 +86,18 @@ impl Component for Model { type Message = Msg; type Properties = (); - fn create(_: Self::Properties, link: ComponentLink) -> Self { + fn create(ctx: &Context) -> Self { Model { rows: Vec::new(), next_id: 1, selected_id: None, rng: SmallRng::from_entropy(), - on_select: link.callback(|id| Msg::Select(id)), - on_remove: link.callback(|id| Msg::Remove(id)), - link, + on_select: ctx.link().callback(|id| Msg::Select(id)), + on_remove: ctx.link().callback(|id| Msg::Remove(id)), } } - fn change(&mut self, _: ()) -> ShouldRender { - false - } - - fn update(&mut self, msg: Self::Message) -> ShouldRender { + fn update(&mut self, _: &Context, msg: Self::Message) -> bool { match msg { Msg::Run(amount) => { let rng = &mut self.rng; @@ -149,24 +143,24 @@ impl Component for Model { true } - fn view(&self) -> Html { + fn view(&self, ctx: &Context) -> Html { let rows: Html = self .rows .iter() .map(|row| { html! { - + } }) .collect(); html! {
- +
{ self.props.data.id } - { self.props.data.label.clone() } +
{ ctx.props().data.id } + { ctx.props().data.label.clone() } - +
{ rows } @@ -180,30 +174,29 @@ impl Component for Model { #[derive(Properties, Clone)] struct JumbotronProps { - link: ComponentLink, + link: Scope, } -struct Jumbotron { - link: ComponentLink, +impl PartialEq for JumbotronProps { + fn eq(&self, _: &Self) -> bool { + // Never changed + true + } } +impl Eq for JumbotronProps {} + +struct Jumbotron; + impl Component for Jumbotron { type Properties = JumbotronProps; type Message = (); - fn create(props: Self::Properties, _: ComponentLink) -> Self { - Self { link: props.link } - } - - fn change(&mut self, _: Self::Properties) -> ShouldRender { - false - } - - fn update(&mut self, _: Self::Message) -> ShouldRender { - false + fn create(_: &Context) -> Self { + Self } - fn view(&self) -> Html { + fn view(&self, ctx: &Context) -> Html { html! {
@@ -213,22 +206,22 @@ impl Component for Jumbotron {
- +
- +
- +
- +
- +
- +
@@ -253,7 +246,6 @@ struct RowState { struct Row { state: RowState, - props: RowProps, } impl RowState { @@ -270,36 +262,26 @@ impl Component for Row { type Message = (); type Properties = RowProps; - fn create(props: Self::Properties, _: ComponentLink) -> Self { + fn create(ctx: &Context) -> Self { Self { - state: RowState::from_props(&props), - props, + state: RowState::from_props(ctx.props()), } } - fn change(&mut self, props: RowProps) -> ShouldRender { - if self.props != props { - self.state = RowState::from_props(&props); - self.props = props; - true - } else { - false - } - } - - fn update(&mut self, _: ()) -> ShouldRender { - false + fn changed(&mut self, ctx: &Context) -> bool { + self.state = RowState::from_props(ctx.props()); + true } - fn view(&self) -> Html { + fn view(&self, ctx: &Context) -> Html { html! { -
- - + + @@ -313,5 +295,5 @@ impl Component for Row { pub fn start() { let document = window().unwrap().document().unwrap(); let mount_el = document.query_selector("#main").unwrap().unwrap(); - App::::new().mount(mount_el); + yew::start_app_in_element::(mount_el); } diff --git a/webdriver-ts-results/.gitignore b/webdriver-ts-results/.gitignore new file mode 100644 index 000000000..5352d2980 --- /dev/null +++ b/webdriver-ts-results/.gitignore @@ -0,0 +1 @@ +table.html diff --git a/webdriver-ts-results/package.json b/webdriver-ts-results/package.json index beaadf2c0..9b1f60bc7 100644 --- a/webdriver-ts-results/package.json +++ b/webdriver-ts-results/package.json @@ -43,8 +43,8 @@ }, "dependencies": { "jStat": "1.7.1", + "plotly.js-cartesian-dist": "^1.45.2", "react": "16.8.4", - "react-dom": "16.8.4", - "plotly.js-cartesian-dist": "^1.45.2" + "react-dom": "16.8.4" } } diff --git a/webdriver-ts-results/src/.gitignore b/webdriver-ts-results/src/.gitignore new file mode 100644 index 000000000..5e92ae6d2 --- /dev/null +++ b/webdriver-ts-results/src/.gitignore @@ -0,0 +1 @@ +results.ts diff --git a/webdriver-ts-results/src/results.ts b/webdriver-ts-results/src/results.ts deleted file mode 100644 index fcb3fc191..000000000 --- a/webdriver-ts-results/src/results.ts +++ /dev/null @@ -1,56 +0,0 @@ -import {RawResult} from './Common'; - -export let results: RawResult[]=[ -{"f":"wasm-bindgen-v0.2.47-keyed","b":"01_run1k","v":[111.679,110.216]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"02_replace1k","v":[108.808,114.004]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"03_update10th1k_x16","v":[175.604,161.142]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"04_select1k","v":[25.468,25.739]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"05_swap1k","v":[55.216,54.351]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"06_remove-one-1k","v":[24.208,28.341]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"07_create10k","v":[1178.322,1184.971]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"08_create1k-after1k_x2","v":[261.251,233.08]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"09_clear1k_x8","v":[124.812,105.986]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"21_ready-memory","v":[1.0803298950195312,1.0803375244140625]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"22_run-memory","v":[1.5682106018066406,1.5682106018066406]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"23_update5-memory","v":[1.8900527954101562,1.8900718688964844]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"24_run5-memory","v":[2.189403533935547,2.189373016357422]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"25_run-clear-memory","v":[2.334686279296875,2.3347625732421875]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"31_startup-ci","v":[1351.92,1350.788]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"32_startup-bt","v":[20.8,18.651999999999994]}, -{"f":"wasm-bindgen-v0.2.47-keyed","b":"34_startup-totalbytes","v":[59.8857421875,59.8857421875]}, -{"f":"yew-v0.16.2-keyed","b":"01_run1k","v":[213.78,202.191]}, -{"f":"yew-v0.16.2-keyed","b":"02_replace1k","v":[73.778,76.039]}, -{"f":"yew-v0.16.2-keyed","b":"03_update10th1k_x16","v":[288.693,237.006]}, -{"f":"yew-v0.16.2-keyed","b":"04_select1k","v":[52.324,42.072]}, -{"f":"yew-v0.16.2-keyed","b":"05_swap1k","v":[32.711,34.04]}, -{"f":"yew-v0.16.2-keyed","b":"06_remove-one-1k","v":[83.746,82.741]}, -{"f":"yew-v0.16.2-keyed","b":"07_create10k","v":[2221.002,2330.112]}, -{"f":"yew-v0.16.2-keyed","b":"08_create1k-after1k_x2","v":[409.533,445.373]}, -{"f":"yew-v0.16.2-keyed","b":"09_clear1k_x8","v":[354.703,335.971]}, -{"f":"yew-v0.16.2-keyed","b":"21_ready-memory","v":[1.0472145080566406,1.0471687316894531]}, -{"f":"yew-v0.16.2-keyed","b":"22_run-memory","v":[2.110729217529297,2.110759735107422]}, -{"f":"yew-v0.16.2-keyed","b":"23_update5-memory","v":[2.428478240966797,2.4285507202148438]}, -{"f":"yew-v0.16.2-keyed","b":"24_run5-memory","v":[2.050769805908203,2.0508155822753906]}, -{"f":"yew-v0.16.2-keyed","b":"25_run-clear-memory","v":[2.3814697265625,2.3814697265625]}, -{"f":"yew-v0.16.2-keyed","b":"31_startup-ci","v":[1351.104,1350.812]}, -{"f":"yew-v0.16.2-keyed","b":"32_startup-bt","v":[26.511999999999997,31.799999999999986]}, -{"f":"yew-v0.16.2-keyed","b":"34_startup-totalbytes","v":[85.0029296875,85.0029296875]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"01_run1k","v":[219.837,203.44]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"02_replace1k","v":[84.511,86.996]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"03_update10th1k_x16","v":[244.717,241.208]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"04_select1k","v":[42.196,43.413]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"05_swap1k","v":[26.277,27.517]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"06_remove-one-1k","v":[79.33,82.96]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"07_create10k","v":[2181.581,2335.49]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"08_create1k-after1k_x2","v":[398.373,397.793]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"09_clear1k_x8","v":[339.692,344.243]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"21_ready-memory","v":[1.0472755432128906,1.0472068786621094]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"22_run-memory","v":[2.111675262451172,2.1116905212402344]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"23_update5-memory","v":[2.4295692443847656,2.42950439453125]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"24_run5-memory","v":[2.050670623779297,2.051464080810547]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"25_run-clear-memory","v":[2.3824424743652344,2.382404327392578]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"31_startup-ci","v":[1350.696,1350.9479999999999]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"32_startup-bt","v":[28.015999999999984,35.37999999999998]}, -{"f":"yew-baseline-v0.16.2-keyed","b":"34_startup-totalbytes","v":[85.1904296875,85.1904296875]},]; -export let frameworks = [{"name":"wasm-bindgen-v0.2.47-keyed","keyed":true},{"name":"yew-v0.16.2-keyed","keyed":true},{"name":"yew-baseline-v0.16.2-keyed","keyed":true}]; -export let benchmarks = [{"id":"01_run1k","label":"create rows","description":"creating 1,000 rows","type":0},{"id":"02_replace1k","label":"replace all rows","description":"updating all 1,000 rows (5 warmup runs).","type":0},{"id":"03_update10th1k_x16","label":"partial update","description":"updating every 10th row for 1,000 rows (3 warmup runs). 16x CPU slowdown.","type":0,"throttleCPU":16},{"id":"04_select1k","label":"select row","description":"highlighting a selected row. (5 warmup runs). 16x CPU slowdown.","type":0,"throttleCPU":16},{"id":"05_swap1k","label":"swap rows","description":"swap 2 rows for table with 1,000 rows. (5 warmup runs). 4x CPU slowdown.","type":0,"throttleCPU":4},{"id":"06_remove-one-1k","label":"remove row","description":"removing one row. (5 warmup runs).","type":0},{"id":"07_create10k","label":"create many rows","description":"creating 10,000 rows","type":0},{"id":"08_create1k-after1k_x2","label":"append rows to large table","description":"appending 1,000 to a table of 10,000 rows. 2x CPU slowdown","type":0,"throttleCPU":2},{"id":"09_clear1k_x8","label":"clear rows","description":"clearing a table with 1,000 rows. 8x CPU slowdown","type":0,"throttleCPU":8},{"id":"21_ready-memory","label":"ready memory","description":"Memory usage after page load.","type":1},{"id":"22_run-memory","label":"run memory","description":"Memory usage after adding 1000 rows.","type":1},{"id":"23_update5-memory","label":"update eatch 10th row for 1k rows (5 cycles)","description":"Memory usage after clicking update every 10th row 5 times","type":1},{"id":"24_run5-memory","label":"replace 1k rows (5 cycles)","description":"Memory usage after clicking create 1000 rows 5 times","type":1},{"id":"25_run-clear-memory","label":"creating/clearing 1k rows (5 cycles)","description":"Memory usage after creating and clearing 1000 rows 5 times","type":1},{"id":"31_startup-ci","label":"consistently interactive","description":"a pessimistic TTI - when the CPU and network are both definitely very idle. (no more CPU tasks over 50ms)","type":2,"property":"TimeToConsistentlyInteractive"},{"id":"32_startup-bt","label":"script bootup time","description":"the total ms required to parse/compile/evaluate all the page's scripts","type":2,"property":"ScriptBootUpTtime"},{"id":"34_startup-totalbytes","label":"total kilobyte weight","description":"network transfer cost (post-compression) of all the resources loaded into the page.","type":2,"property":"TotalKiloByteWeight"}]; diff --git a/webdriver-ts-results/table.html b/webdriver-ts-results/table.html deleted file mode 100644 index 1da64ebc6..000000000 --- a/webdriver-ts-results/table.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Interactive Results - - - - -
- - diff --git a/webdriver-ts/.gitignore b/webdriver-ts/.gitignore new file mode 100644 index 000000000..91a9c5928 --- /dev/null +++ b/webdriver-ts/.gitignore @@ -0,0 +1 @@ +results.json diff --git a/webdriver-ts/package.json b/webdriver-ts/package.json index 922721543..db91a6b58 100644 --- a/webdriver-ts/package.json +++ b/webdriver-ts/package.json @@ -42,10 +42,10 @@ "jstat": "1.9.2", "lighthouse": "5.6.0", "lodash": "4.17.15", + "npm-check-updates": "4.0.1", "ramda": "0.27.0", "selenium-webdriver": "4.0.0-alpha.1", - "yargs": "15.1.0", - "npm-check-updates": "4.0.1", - "semver": "7.1.2" + "semver": "7.1.2", + "yargs": "15.1.0" } } diff --git a/webdriver-ts/results.json b/webdriver-ts/results.json deleted file mode 100644 index 8e1929fac..000000000 --- a/webdriver-ts/results.json +++ /dev/null @@ -1 +0,0 @@ -[{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"01_run1k","values":[111.679,110.216]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"02_replace1k","values":[108.808,114.004]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"03_update10th1k_x16","values":[175.604,161.142]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"04_select1k","values":[25.468,25.739]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"05_swap1k","values":[55.216,54.351]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"06_remove-one-1k","values":[24.208,28.341]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"07_create10k","values":[1178.322,1184.971]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"08_create1k-after1k_x2","values":[261.251,233.08]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"09_clear1k_x8","values":[124.812,105.986]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"21_ready-memory","values":[1.0803298950195312,1.0803375244140625]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"22_run-memory","values":[1.5682106018066406,1.5682106018066406]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"23_update5-memory","values":[1.8900527954101562,1.8900718688964844]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"24_run5-memory","values":[2.189403533935547,2.189373016357422]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"25_run-clear-memory","values":[2.334686279296875,2.3347625732421875]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"31_startup-ci","values":[1351.92,1350.788]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"32_startup-bt","values":[20.8,18.651999999999994]},{"framework":"wasm-bindgen-v0.2.47-keyed","benchmark":"34_startup-totalbytes","values":[59.8857421875,59.8857421875]},{"framework":"yew-v0.16.2-keyed","benchmark":"01_run1k","values":[213.78,202.191]},{"framework":"yew-v0.16.2-keyed","benchmark":"02_replace1k","values":[73.778,76.039]},{"framework":"yew-v0.16.2-keyed","benchmark":"03_update10th1k_x16","values":[288.693,237.006]},{"framework":"yew-v0.16.2-keyed","benchmark":"04_select1k","values":[52.324,42.072]},{"framework":"yew-v0.16.2-keyed","benchmark":"05_swap1k","values":[32.711,34.04]},{"framework":"yew-v0.16.2-keyed","benchmark":"06_remove-one-1k","values":[83.746,82.741]},{"framework":"yew-v0.16.2-keyed","benchmark":"07_create10k","values":[2221.002,2330.112]},{"framework":"yew-v0.16.2-keyed","benchmark":"08_create1k-after1k_x2","values":[409.533,445.373]},{"framework":"yew-v0.16.2-keyed","benchmark":"09_clear1k_x8","values":[354.703,335.971]},{"framework":"yew-v0.16.2-keyed","benchmark":"21_ready-memory","values":[1.0472145080566406,1.0471687316894531]},{"framework":"yew-v0.16.2-keyed","benchmark":"22_run-memory","values":[2.110729217529297,2.110759735107422]},{"framework":"yew-v0.16.2-keyed","benchmark":"23_update5-memory","values":[2.428478240966797,2.4285507202148438]},{"framework":"yew-v0.16.2-keyed","benchmark":"24_run5-memory","values":[2.050769805908203,2.0508155822753906]},{"framework":"yew-v0.16.2-keyed","benchmark":"25_run-clear-memory","values":[2.3814697265625,2.3814697265625]},{"framework":"yew-v0.16.2-keyed","benchmark":"31_startup-ci","values":[1351.104,1350.812]},{"framework":"yew-v0.16.2-keyed","benchmark":"32_startup-bt","values":[26.511999999999997,31.799999999999986]},{"framework":"yew-v0.16.2-keyed","benchmark":"34_startup-totalbytes","values":[85.0029296875,85.0029296875]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"01_run1k","values":[219.837,203.44]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"02_replace1k","values":[84.511,86.996]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"03_update10th1k_x16","values":[244.717,241.208]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"04_select1k","values":[42.196,43.413]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"05_swap1k","values":[26.277,27.517]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"06_remove-one-1k","values":[79.33,82.96]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"07_create10k","values":[2181.581,2335.49]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"08_create1k-after1k_x2","values":[398.373,397.793]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"09_clear1k_x8","values":[339.692,344.243]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"21_ready-memory","values":[1.0472755432128906,1.0472068786621094]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"22_run-memory","values":[2.111675262451172,2.1116905212402344]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"23_update5-memory","values":[2.4295692443847656,2.42950439453125]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"24_run5-memory","values":[2.050670623779297,2.051464080810547]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"25_run-clear-memory","values":[2.3824424743652344,2.382404327392578]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"31_startup-ci","values":[1350.696,1350.9479999999999]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"32_startup-bt","values":[28.015999999999984,35.37999999999998]},{"framework":"yew-baseline-v0.16.2-keyed","benchmark":"34_startup-totalbytes","values":[85.1904296875,85.1904296875]}] \ No newline at end of file
{ self.props.data.id } - { self.props.data.label.clone() } +
{ ctx.props().data.id } + { ctx.props().data.label.clone() } - +