From 10e7d7be485ea7339b4f0c42e86d6f0858b9a1e2 Mon Sep 17 00:00:00 2001 From: evgeny-nadymov Date: Fri, 19 Jul 2019 13:32:06 +0300 Subject: [PATCH] Fixes --- package-lock.json | 149 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 8 ++- src/App.js | 70 ++++++++++------------ 3 files changed, 186 insertions(+), 41 deletions(-) diff --git a/package-lock.json b/package-lock.json index 51976c7..6021d7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4786,6 +4786,12 @@ "minimalistic-crypto-utils": "^1.0.0" } }, + "email-addresses": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.0.3.tgz", + "integrity": "sha512-kUlSC06PVvvjlMRpNIl3kR1NRXLEe86VQ7N0bQeaCZb2g+InShCeHQp/JvyYNTugMnRN2NvJhHlc3q12MWbbpg==", + "dev": true + }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", @@ -5839,6 +5845,33 @@ "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=" }, + "filename-reserved-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz", + "integrity": "sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q=", + "dev": true + }, + "filenamify": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-1.2.1.tgz", + "integrity": "sha1-qfL/0RxQO+0wABUCknI3jx8TZaU=", + "dev": true, + "requires": { + "filename-reserved-regex": "^1.0.0", + "strip-outer": "^1.0.0", + "trim-repeated": "^1.0.0" + } + }, + "filenamify-url": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/filenamify-url/-/filenamify-url-1.0.0.tgz", + "integrity": "sha1-syvYExnvWGO3MHi+1Q9GpPeXX1A=", + "dev": true, + "requires": { + "filenamify": "^1.0.0", + "humanize-url": "^1.0.0" + } + }, "fileset": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", @@ -6909,6 +6942,37 @@ "assert-plus": "^1.0.0" } }, + "gh-pages": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-2.0.1.tgz", + "integrity": "sha512-uFlk3bukljeiWKQ2XvPfjcSi/ou7IfoDf2p+Fj672saLAr8bnOdFVqI/JSgrSgInKpCg5BksxEwGUl++dbg8Dg==", + "dev": true, + "requires": { + "async": "^2.6.1", + "commander": "^2.18.0", + "email-addresses": "^3.0.1", + "filenamify-url": "^1.0.0", + "fs-extra": "^7.0.0", + "globby": "^6.1.0", + "graceful-fs": "^4.1.11", + "rimraf": "^2.6.2" + }, + "dependencies": { + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + } + } + }, "glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -7650,6 +7714,30 @@ "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=" }, + "humanize-url": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/humanize-url/-/humanize-url-1.0.1.tgz", + "integrity": "sha1-9KuZ4NKIF0yk4eUEB8VfuuRk7/8=", + "dev": true, + "requires": { + "normalize-url": "^1.0.0", + "strip-url-auth": "^1.0.0" + }, + "dependencies": { + "normalize-url": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz", + "integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=", + "dev": true, + "requires": { + "object-assign": "^4.0.1", + "prepend-http": "^1.0.0", + "query-string": "^4.1.0", + "sort-keys": "^1.0.0" + } + } + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -8024,6 +8112,12 @@ "path-is-inside": "^1.0.1" } }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -12554,6 +12648,12 @@ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, "preserve": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", @@ -12723,6 +12823,16 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, + "query-string": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", + "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "dev": true, + "requires": { + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, "querystring": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", @@ -14505,6 +14615,15 @@ } } }, + "sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", + "dev": true, + "requires": { + "is-plain-obj": "^1.0.0" + } + }, "source-list-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", @@ -14752,6 +14871,12 @@ "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "dev": true + }, "string-length": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", @@ -14853,6 +14978,21 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, + "strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.2" + } + }, + "strip-url-auth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-url-auth/-/strip-url-auth-1.0.1.tgz", + "integrity": "sha1-IrD6OkE4WzO+PzMVUbu4N/oM164=", + "dev": true + }, "style-loader": { "version": "0.23.1", "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-0.23.1.tgz", @@ -15229,6 +15369,15 @@ "punycode": "^2.1.0" } }, + "trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.2" + } + }, "trim-right": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", diff --git a/package.json b/package.json index d099717..a7c947b 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "homepage": "https://evgeny-nadymov.github.io/wasm-caching", "name": "wasm-caching", "version": "0.1.0", "private": true, @@ -12,7 +13,9 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "predeploy": "npm run build", + "deploy": "gh-pages -d build" }, "eslintConfig": { "extends": "react-app" @@ -28,5 +31,8 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "devDependencies": { + "gh-pages": "^2.0.1" } } diff --git a/src/App.js b/src/App.js index 458c7e8..0ce4ebd 100644 --- a/src/App.js +++ b/src/App.js @@ -5,57 +5,46 @@ import './App.css'; class App extends React.Component{ - handleInstantiateFibonacchi = async event => { + handleCompileTdlib = async event => { event.preventDefault(); - const fetchPromise = fetch('fibonacci.wasm'); - const { instance } = await WebAssembly.instantiateStreaming(fetchPromise); - const result = instance.exports.fibonacci(42); - console.log(result); + console.log('compileStreaming start'); + const t0 = performance.now(); + const fetchPromise = fetch('ef5b7375afcb3e32ba4066a0003c699c.wasm'); + const module = await WebAssembly.compileStreaming(fetchPromise); + console.log('compileStreaming finish time=' + (performance.now() - t0)); }; handleInstantiateTdlib = async event => { event.preventDefault(); - const fetchPromise = fetch('ef5b7375afcb3e32ba4066a0003c699c.wasm'); - const module = await WebAssembly.compileStreaming(fetchPromise); - console.log(module); + console.log('start tdlib'); + let options = { + logVerbosityLevel: 1, + jsLogVerbosityLevel: 3, + mode: 'wasm', + prefix: 'tdlib', + readOnly: false, + isBackground: false, + useDatabase: false + }; + + this.client = new TdClient(options); + this.client.onUpdate = update => { - // let options = { - // logVerbosityLevel: 1, - // jsLogVerbosityLevel: 3, - // mode: 'wasm', - // prefix: 'tdlib', - // readOnly: false, - // isBackground: false, - // useDatabase: false - // }; - // - // this.client = new TdClient(options); - // this.client.onUpdate = update => { - // - // }; + }; }; - generateBigWasm = async event => { - // event.preventDefault(); + handleInstantiateFibonacchi = async event => { + event.preventDefault(); -// let str = ''; -// for (let i = 0; i < 1000; i++) { -// str += ` -// -// WASM_EXPORT -// int fibonacci${i}(int n) { -// int i, t, a = 0, b = 1; -// for (i = 0; i < n; i++) { -// t = a + b; -// a = b; -// b = t; -// } -// return b; -// }`; -// } -// console.log(str); + console.log('instantiateStreaming start'); + const t0 = performance.now(); + const fetchPromise = fetch('fibonacci.wasm'); + const { instance } = await WebAssembly.instantiateStreaming(fetchPromise); + console.log('instantiateStreaming finish time=' + (performance.now() - t0)); + const result = instance.exports.fibonacci(42); + console.log(result); }; render() { @@ -67,6 +56,7 @@ class App extends React.Component{

Edit src/App.js and save to reload.

+