Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Speed up playground build #2907

Merged
merged 9 commits into from
Oct 21, 2023
Merged

build: Speed up playground build #2907

merged 9 commits into from
Oct 21, 2023

Conversation

max-sixty
Copy link
Member

As discussed in #1836 (comment)

@max-sixty
Copy link
Member Author

max-sixty commented Jun 22, 2023

This works quite well, and solves most of the runtime issues with wasm-pack (but not the dependency issues). We could postpone #1836 (comment). And remove the recent additional tasks around caching the playground etc.

But unfortunately we get another stack size issue!

Failed to decode custom "name" section @20041605; ignoring (Maximum call stack size exceeded).

So maybe we look at this again after #2908 is solved...

max-sixty added a commit to max-sixty/prql that referenced this pull request Jun 22, 2023
Changes we can merge now
max-sixty added a commit that referenced this pull request Jun 22, 2023
@max-sixty max-sixty marked this pull request as draft June 22, 2023 20:42
@max-sixty
Copy link
Member Author

Since #2908 seems to be solved, we no longer the stack overflow above.

But we get a different error — Module parse failed: Unexpected section: 0x9


ERROR in ../../bindings/prql-js/dist/bundler/prql_js_bg.wasm
Module parse failed: Unexpected section: 0x9
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Error: Unexpected section: 0x9
    at new CompileError (/Users/maximilian/workspace/prql/web/playground/node_modules/@webassemblyjs/helper-api-error/lib/index.js:40:109)
    at parseSection (/Users/maximilian/workspace/prql/web/playground/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1329:76)
    at Object.decode (/Users/maximilian/workspace/prql/web/playground/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1712:25)
    at decode (/Users/maximilian/workspace/prql/web/playground/node_modules/@webassemblyjs/wasm-parser/lib/index.js:248:21)
    at WebAssemblyParser.parse (/Users/maximilian/workspace/prql/web/playground/node_modules/webpack/lib/wasm-async/AsyncWebAssemblyParser.js:48:19)
    at /Users/maximilian/workspace/prql/web/playground/node_modules/webpack/lib/NormalModule.js:1089:26
    at processResult (/Users/maximilian/workspace/prql/web/playground/node_modules/webpack/lib/NormalModule.js:802:11)
    at /Users/maximilian/workspace/prql/web/playground/node_modules/webpack/lib/NormalModule.js:862:5
    at /Users/maximilian/workspace/prql/web/playground/node_modules/loader-runner/lib/LoaderRunner.js:407:3
    at iterateNormalLoaders (/Users/maximilian/workspace/prql/web/playground/node_modules/loader-runner/lib/LoaderRunner.js:233:10)
 @ ../../bindings/prql-js/dist/bundler/prql_js.js 3:0-42 5:15-19
 @ ./src/workbench/Workbench.js 5:0-45 71:12-24 98:13-28 104:13-26
 @ ./src/app/App.js 5:0-47 66:37-46
 @ ./src/index.js 8:0-28 13:33-36

Searching for this gives a couple of issues: rustwasm/wasm-pack#1050 & webpack/webpack#14087. These both reference https://github.com/wasm-tool/wasm-pack-plugin, which we don't use1.

Overall I'm not experienced enough at JS to do this quickly or well, but if someone wants to investigate further, that'd be welcome.

Footnotes

  1. though maybe we could? It looks like one advantage is that it'll identify when we need to recompile the rust, rather than recompiling each time, maybe solving some of the symptoms of https://github.com/PRQL/prql/issues/1836. If anyone wants to have a go, that'd be interesting.)

@max-sixty
Copy link
Member Author

This now works great! I think because of the move to vite — courtesy of @vanillajonathan .

So I'm merging. task run-playground is down to 7 seconds, including recompilation, from ~40 seconds. Note that it does make the local playground experience slightly-but-noticeably laggier. So if that's a concern, run without the --profile=dev. This only affects local development, not the published version.

@max-sixty max-sixty marked this pull request as ready for review October 21, 2023 20:50
@max-sixty max-sixty enabled auto-merge (squash) October 21, 2023 20:53
@max-sixty max-sixty merged commit c5d6ccb into PRQL:main Oct 21, 2023
35 checks passed
@max-sixty max-sixty deleted the npm branch October 21, 2023 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants