Skip to content

Commit

Permalink
Use web workers to speed up parsing (logseq#2655)
Browse files Browse the repository at this point in the history
* wip: use web workers to speed up parsing

* chore: uncomment forget.config.js

* fix: parser pool initialization

* fix: extract parser-worker

* fix: can't run the parser worker in the release mode

* fix: extract async tests

* fix: dsl query async test

* fix: img path in dev mode
  • Loading branch information
tiensonqin authored Aug 18, 2021
1 parent 0b3c2bf commit e87f83c
Show file tree
Hide file tree
Showing 23 changed files with 5,289 additions and 228 deletions.
6 changes: 3 additions & 3 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
hiccups/hiccups {:mvn/version "0.3.0"}
tongue/tongue {:mvn/version "0.2.9"}
org.clojure/core.async {:mvn/version "1.3.610"}
thheller/shadow-cljs {:mvn/version "2.12.5"}
thheller/shadow-cljs {:mvn/version "2.15.3"}
expound/expound {:mvn/version "0.8.6"}
com.lambdaisland/glogi {:mvn/version "1.0.116"}
binaryage/devtools {:mvn/version "1.0.2"}
Expand All @@ -39,14 +39,14 @@
frankiesardo/linked {:mvn/version "1.3.0"}}

:aliases {:cljs {:extra-paths ["src/dev-cljs/" "src/test/" "src/electron/"]
:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.844"}
:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.879"}
org.clojure/tools.namespace {:mvn/version "0.2.11"}
cider/cider-nrepl {:mvn/version "0.26.0"}
org.clojars.knubie/cljs-run-test {:mvn/version "1.0.1"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
:test
{:extra-paths ["src/test/"]
:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.844"}
:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.879"}
org.clojure/test.check {:mvn/version "RELEASE"}
org.clojars.knubie/cljs-run-test {:mvn/version "1.0.1"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"postcss-import-ext-glob": "^2.0.1",
"postcss-nested": "5.0.5",
"purgecss": "4.0.2",
"shadow-cljs": "2.12.5",
"shadow-cljs": "2.15.3",
"stylelint": "^13.8.0",
"stylelint-config-standard": "^20.0.0",
"tailwindcss": "2.2.4"
Expand All @@ -44,19 +44,18 @@
"gulp:build": "cross-env NODE_ENV=production gulp build",
"css:build": "postcss tailwind.all.css -o static/css/style.css --verbose --env production",
"css:watch": "TAILWIND_MODE=watch postcss tailwind.all.css -o static/css/style.css --verbose --watch",
"cljs:watch": "clojure -M:cljs watch app electron",
"cljs:electron-watch": "clojure -M:cljs watch app electron",
"cljs:release": "clojure -M:cljs release app publishing electron",
"cljs:electron-release": "clojure -M:cljs release app publishing electron --config-merge '{:asset-path \"./js\"}'",
"cljs:watch": "clojure -M:cljs watch parser-worker app electron",
"cljs:electron-watch": "clojure -M:cljs watch parser-worker app electron",
"cljs:release": "clojure -M:cljs release parser-worker app publishing electron",
"cljs:test": "clojure -M:test compile test",
"cljs:run-test": "node static/tests.js",
"cljs:watch-app": "clojure -M:cljs watch app cards",
"cljs:release-app": "clojure -M:cljs release app",
"cljs:release-publishing": "clojure -M:cljs release publishing",
"cljs:watch-app": "clojure -M:cljs watch parser-worker app cards",
"cljs:release-app": "clojure -M:cljs release parser-worker app",
"cljs:release-publishing": "clojure -M:cljs release parser-worker publishing",
"cljs:dev-release-app": "clojure -M:cljs release app --config-merge '{:closure-defines {frontend.config/DEV-RELEASE true}}'",
"cljs:debug": "clojure -M:cljs release app --debug",
"cljs:report": "clojure -M:cljs run shadow.cljs.build-report app report.html",
"cljs:build-electron": "clojure -A:cljs compile app electron"
"cljs:debug": "clojure -M:cljs release parser-worker app --debug",
"cljs:report": "clojure -M:cljs run shadow.cljs.build-report parser-worker app report.html",
"cljs:build-electron": "clojure -A:cljs compile parser-worker app electron"
},
"dependencies": {
"@excalidraw/excalidraw": "^0.4.2",
Expand Down Expand Up @@ -96,6 +95,7 @@
"react-transition-group": "^4.3.0",
"react-tweet-embed": "^1.2.2",
"reakit": "^0.11.1",
"threads": "^1.6.5",
"yargs-parser": "^20.2.4"
}
}
25 changes: 14 additions & 11 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@
<meta content="black-translucent" name="apple-mobile-web-app-status-bar-style">
<meta content="yes" name="mobile-web-app-capable">
<meta content="summary" name="twitter:card">
<meta content="A local-first knowledge base which can be synced using Git." name="twitter:description">
<meta content="A privacy-first, open-source platform for knowledge management and collaboration." name="twitter:description">
<meta content="@logseq" name="twitter:site">
<meta content="A local-first knowledge base." name="twitter:title">
<meta content="A privacy-first, open-source platform for knowledge management and collaboration." name="twitter:title">
<meta content="https://asset.logseq.com/static/img/logo.png" name="twitter:image:src">
<meta content="A local-first knowledge base which can be synced using Git." name="twitter:image:alt">
<meta content="A local-first knowledge base." property="og:title">
<meta content="A privacy-first, open-source platform for knowledge management and collaboration." name="twitter:image:alt">
<meta content="A privacy-first, open-source platform for knowledge management and collaboration." property="og:title">
<meta content="site" property="og:type">
<meta content="https://logseq.com" property="og:url">
<meta content="https://asset.logseq.com/static/img/logo.png" property="og:image">
<meta content="A local-first knowledge base which can be synced using Git." property="og:description">
<title>Logseq: A local-first knowledge base</title>
<meta content="A privacy-first, open-source platform for knowledge management and collaboration." property="og:description">
<title>Logseq: "A privacy-first platform for knowledge management and collaboration."</title>
<meta content="logseq" property="og:site_name">
<meta description="A local-first knowledge base which can be synced using Git.">
<meta content="A privacy-first, open-source platform for knowledge management and collaboration." name="description">
</head>
<body>
<div id="root"></div>
<script>window.user = null</script>
<script>window.__LSP__HOST__ = true</script>
<script defer src="/static/js/lsplugin.core.js"></script>
<script src="/static/js/magic_portal.js"></script>
<script>let worker = new Worker('/static/js/worker.js')
const portal = new MagicPortal(worker);
Expand All @@ -48,8 +47,12 @@
window.workerThread = workerThread
})()
</script>
<script src="/static/js/main.js"></script>
<script src="/static/js/highlight.min.js"></script>
<script src="/static/js/interact.min.js"></script>
<script defer src="/static/js/highlight.min.js"></script>
<script defer src="/static/js/interact.min.js"></script>
<script defer src="/static/js/lsplugin.core.js"></script>
<script defer src="/static/js/main.js"></script>
<script defer src="/static/js/code-editor.js"></script>
<script defer src="/static/js/age-encryption.js"></script>
<script defer src="/static/js/excalidraw.js"></script>
</body>
</html>
62 changes: 0 additions & 62 deletions resources/electron-dev.html

This file was deleted.

4 changes: 2 additions & 2 deletions resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"forge": "./forge.config.js"
},
"dependencies": {
"better-sqlite3": "7.4.1",
"better-sqlite3": "7.4.3",
"chokidar": "^3.5.1",
"electron-log": "^4.3.1",
"electron-squirrel-startup": "^1.0.0",
Expand All @@ -36,7 +36,7 @@
"@electron-forge/maker-rpm": "^6.0.0-beta.57",
"@electron-forge/maker-squirrel": "^6.0.0-beta.57",
"@electron-forge/maker-zip": "^6.0.0-beta.57",
"electron": "^13.0.0",
"electron": "^13.1.9",
"electron-builder": "^22.11.7",
"electron-forge-maker-appimage": "trusktr/electron-forge-maker-appimage#patch-1",
"electron-rebuild": "^2.3.5"
Expand Down
Loading

0 comments on commit e87f83c

Please sign in to comment.