From 8a2c1ea7d469a8ac5d176795f2452774c6ddd531 Mon Sep 17 00:00:00 2001 From: mizzick Date: Mon, 30 Sep 2019 16:53:56 +0700 Subject: [PATCH] #233 performance --- ElectronMainApp/package.json | 2 +- ElectronMainApp/src/main/app/antibanner.js | 1 + .../content-blocker-adapter.js | 5 + ElectronMainApp/yarn.lock | 159 +++++++++--------- 4 files changed, 89 insertions(+), 78 deletions(-) diff --git a/ElectronMainApp/package.json b/ElectronMainApp/package.json index af57a22b..b5eca875 100644 --- a/ElectronMainApp/package.json +++ b/ElectronMainApp/package.json @@ -21,7 +21,7 @@ "electron-log": "^3.0.6", "electron-reload": "^1.3.0", "electron-simple-updater": "^1.5.0", - "electron-store": "^2.0.0", + "electron-store": "^5.0.0", "electron-updater": "^4.0.6", "filters-downloader": "git+https://github.com/AdguardTeam/FiltersDownloader.git#a7d2177", "i18n": "^0.8.3", diff --git a/ElectronMainApp/src/main/app/antibanner.js b/ElectronMainApp/src/main/app/antibanner.js index 16426a25..556625e7 100644 --- a/ElectronMainApp/src/main/app/antibanner.js +++ b/ElectronMainApp/src/main/app/antibanner.js @@ -249,6 +249,7 @@ module.exports = (() => { const filter = filters[i]; const group = subscriptions.getGroup(filter.groupId); if (filter.enabled && group.enabled) { + // TODO: Slowdown #1 - storage dfds.push(filterRules.loadFilterRulesFromStorage(filter.filterId, rulesFilterMap)); } } diff --git a/ElectronMainApp/src/main/app/content-blocker/content-blocker-adapter.js b/ElectronMainApp/src/main/app/content-blocker/content-blocker-adapter.js index c752f890..a1c65709 100644 --- a/ElectronMainApp/src/main/app/content-blocker/content-blocker-adapter.js +++ b/ElectronMainApp/src/main/app/content-blocker/content-blocker-adapter.js @@ -43,6 +43,11 @@ module.exports = (function () { for (let group of grouped) { let json = emptyBlockerJSON; + + + // TODO: Slowdown #2 - converter + //const result = {}; + const result = jsonFromFilters(group.rules.map(x => x.ruleText), RULES_LIMIT, false, false); if (result && result.converted) { json = JSON.parse(result.converted); diff --git a/ElectronMainApp/yarn.lock b/ElectronMainApp/yarn.lock index 1d9c1637..4df159c6 100644 --- a/ElectronMainApp/yarn.lock +++ b/ElectronMainApp/yarn.lock @@ -3,8 +3,8 @@ "@types/node@^10.12.18": - version "10.14.16" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.16.tgz#4d690c96cbb7b2728afea0e260d680501b3da5cf" + version "10.14.19" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.19.tgz#f52742c7834a815dedf66edfc8a51547e2a67342" "@types/semver@^6.0.1": version "6.0.1" @@ -18,7 +18,7 @@ accessibility-developer-tools@^2.11.0: version "2.12.0" resolved "https://registry.yarnpkg.com/accessibility-developer-tools/-/accessibility-developer-tools-2.12.0.tgz#3da0cce9d6ec6373964b84f35db7cfc3df7ab514" -ajv@^6.5.5: +ajv@^6.10.2, ajv@^6.5.5: version "6.10.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" dependencies: @@ -566,15 +566,19 @@ concat-stream@1.6.2, concat-stream@^1.6.0: readable-stream "^2.2.2" typedarray "^0.0.6" -conf@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/conf/-/conf-2.2.0.tgz#ee282efafc1450b61e205372041ad7d866802d9a" - dependencies: - dot-prop "^4.1.0" - env-paths "^1.0.0" - make-dir "^1.0.0" - pkg-up "^2.0.0" - write-file-atomic "^2.3.0" +conf@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/conf/-/conf-6.0.1.tgz#3d0f681ac62e2c528c8a854dfb7ff42ee93195db" + dependencies: + ajv "^6.10.2" + dot-prop "^5.0.0" + env-paths "^2.2.0" + json-schema-typed "^7.0.1" + make-dir "^3.0.0" + onetime "^5.1.0" + pkg-up "^3.0.1" + semver "^6.2.0" + write-file-atomic "^3.0.0" config@^1.31.0: version "1.31.0" @@ -741,11 +745,11 @@ devtron@^1.4.0: highlight.js "^9.3.0" humanize-plus "^1.8.1" -dot-prop@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" +dot-prop@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.1.0.tgz#bdd8c986a77b83e3fca524e53786df916cabbd8a" dependencies: - is-obj "^1.0.0" + is-obj "^2.0.0" duplexify@^3.6.0: version "3.7.1" @@ -826,12 +830,12 @@ electron-localshortcut@^3.1.0: keyboardevents-areequal "^0.2.1" electron-log@^3.0.6: - version "3.0.7" - resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-3.0.7.tgz#bfdba9489c84b1301d6067028fce2f4cb2f89d7f" + version "3.0.8" + resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-3.0.8.tgz#ea672dc40b560143ed5d887eff1ff1904fe9ef71" "electron-osx-sign@github:electron-userland/electron-osx-sign": - version "0.4.13" - resolved "https://codeload.github.com/electron-userland/electron-osx-sign/tar.gz/a54325a972293b96161ebd929898de25ad868a66" + version "0.4.14" + resolved "https://codeload.github.com/electron-userland/electron-osx-sign/tar.gz/ebc478e8329e7ad769bfd9bad8794f76b629cea4" dependencies: bluebird "^3.5.0" compare-version "^0.1.2" @@ -867,11 +871,12 @@ electron-simple-updater@^1.5.0: httpreq "0.4.24" semver "*" -electron-store@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/electron-store/-/electron-store-2.0.0.tgz#1035cca2a95409d1f54c7466606345852450d64a" +electron-store@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/electron-store/-/electron-store-5.0.0.tgz#d4dc410a49c50c8ef3a8db34b3bdc4097188247f" dependencies: - conf "^2.0.0" + conf "^6.0.0" + type-fest "^0.7.1" electron-updater@^4.0.6: version "4.1.2" @@ -887,8 +892,8 @@ electron-updater@^4.0.6: semver "^6.2.0" electron@^5.0.6: - version "5.0.10" - resolved "https://registry.yarnpkg.com/electron/-/electron-5.0.10.tgz#a3819c3ff8d05ee57315bfabe2d61d3529f5659c" + version "5.0.11" + resolved "https://registry.yarnpkg.com/electron/-/electron-5.0.11.tgz#764eb460aa84fbfcb3dc30385f5f9509cb724751" dependencies: "@types/node" "^10.12.18" electron-download "^4.1.0" @@ -908,6 +913,10 @@ env-paths@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" +env-paths@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43" + errlop@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/errlop/-/errlop-1.1.1.tgz#d9ae4c76c3e64956c5d79e6e035d6343bfd62250" @@ -1130,12 +1139,6 @@ find-up@^1.0.0: path-exists "^2.0.0" pinkie-promise "^2.0.0" -find-up@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" - dependencies: - locate-path "^2.0.0" - find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -1728,9 +1731,9 @@ is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" -is-obj@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" +is-obj@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982" is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" @@ -1744,7 +1747,7 @@ is-relative@^1.0.0: dependencies: is-unc-path "^1.0.0" -is-typedarray@~1.0.0: +is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -1813,6 +1816,10 @@ json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" +json-schema-typed@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/json-schema-typed/-/json-schema-typed-7.0.1.tgz#5e56564b5a0950423e22b285a30ade219e38084d" + json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" @@ -1930,13 +1937,6 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" -locate-path@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" - dependencies: - p-locate "^2.0.0" - path-exists "^3.0.0" - locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -1979,11 +1979,11 @@ lru-queue@0.1: dependencies: es5-ext "~0.10.2" -make-dir@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c" +make-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.0.0.tgz#1b5f39f6b9270ed33f9f054c5c0f84304989f801" dependencies: - pify "^3.0.0" + semver "^6.0.0" make-iterator@^1.0.0: version "1.0.1" @@ -2095,6 +2095,10 @@ mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + "minimatch@2 || 3", minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -2378,6 +2382,12 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + dependencies: + mimic-fn "^2.1.0" + ora@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/ora/-/ora-3.4.0.tgz#bf0752491059a3ef3ed4c85097531de9fdbcd318" @@ -2416,34 +2426,18 @@ osenv@^0.1.4: os-homedir "^1.0.0" os-tmpdir "^1.0.0" -p-limit@^1.1.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" - dependencies: - p-try "^1.0.0" - p-limit@^2.0.0: version "2.2.1" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" dependencies: p-try "^2.0.0" -p-locate@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" - dependencies: - p-limit "^1.1.0" - p-locate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" dependencies: p-limit "^2.0.0" -p-try@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" - p-try@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" @@ -2538,10 +2532,6 @@ pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" -pify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" - pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" @@ -2552,11 +2542,11 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" -pkg-up@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f" +pkg-up@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5" dependencies: - find-up "^2.1.0" + find-up "^3.0.0" plist@^3.0.1: version "3.0.1" @@ -2592,7 +2582,11 @@ progress-stream@^1.1.0: speedometer "~0.1.2" through2 "~0.2.3" -psl@^1.1.24, psl@^1.1.28: +psl@^1.1.24: + version "1.4.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" + +psl@^1.1.28: version "1.3.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.3.0.tgz#e1ebf6a3b5564fa8376f3da2275da76d875ca1bd" @@ -2901,7 +2895,7 @@ semver-greatest-satisfied-range@^1.1.0: dependencies: sver-compat "^1.5.0" -semver@*, semver@^6.2.0: +semver@*, semver@^6.0.0, semver@^6.2.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" @@ -3296,6 +3290,10 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" +type-fest@^0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.7.1.tgz#8dda65feaf03ed78f0a3f9678f1869147f7c5c48" + type@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/type/-/type-1.0.3.tgz#16f5d39f27a2d28d86e48f8981859e9d3296c179" @@ -3314,6 +3312,12 @@ typechecker@~2.0.1: version "2.0.8" resolved "https://registry.yarnpkg.com/typechecker/-/typechecker-2.0.8.tgz#e83da84bb64c584ccb345838576c40b0337db82e" +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + dependencies: + is-typedarray "^1.0.0" + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -3521,13 +3525,14 @@ wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" -write-file-atomic@^2.3.0: - version "2.4.3" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" +write-file-atomic@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.0.tgz#1b64dbbf77cb58fd09056963d63e62667ab4fb21" dependencies: - graceful-fs "^4.1.11" imurmurhash "^0.1.4" + is-typedarray "^1.0.0" signal-exit "^3.0.2" + typedarray-to-buffer "^3.1.5" xmlbuilder@^9.0.7: version "9.0.7"