-
Notifications
You must be signed in to change notification settings - Fork 249
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
schema-wasm: optimize for -Oz
with LLVM and Binaryen
#4449
base: main
Are you sure you want to change the base?
Conversation
This PR explores how much size can be trivially saved in WASM binaries compared to how we currently build them, using `prisma-schema-wasm` as the example. This is not necessarily useful for `prisma-schema-wasm` but could be useful for the QE. - Enable more aggressive size optimization level in LLVM (`z` instead of `s`) at some runtime performance cost. - Further optimize the WASM binary for size using `wasm-opt` from Binaryen. | optimization level | size | ratio | | ---------------------- | ------- | ------ | | `-Os` (baseline) | 2742189 | 100% | | `-Oz` | 2558271 | 93.29% | | `-Oz` + `wasm-opt -Oz` | 2081699 | 75.91% |
Marking as draft to make it explicit that it's just a random experiment, not necessarily intended to be merged unless we decide we actually want to do this and have confirmed that performance is acceptable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think merging this would be great!
The main benefits that I see would be that
- it makes the VS Code extension smaller for all users via making https://www.npmjs.com/package/@prisma/prisma-schema-wasm smaller
- it makes the https://www.npmjs.com/package/prisma Prisma CLI smaller for all users (as it ships the
.wasm
file).
CodSpeed Performance ReportMerging #4449 will not alter performanceComparing Summary
|
Some other numbers from yesterday that I didn't post:
* had to build a bit differently with wasm-bindgen before wasm-opt, otherwise wasm-bindgen was panicking, TODO submit a bug report Next steps:
|
Contributes to https://github.com/prisma/team-orm/issues/584 |
Removed from DA project based on feedback from Alberto+Serhii. |
This PR explores how much size can be trivially saved in WASM binaries
compared to how we currently build them, using
prisma-schema-wasm
asthe example. This is not necessarily useful for
prisma-schema-wasm
but could be useful for the QE.
z
instead ofs
) at some runtime performance cost.wasm-opt
fromBinaryen.
-Os
(baseline)-Oz
-Oz
+wasm-opt -Oz