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

[Feature] Improve HMR and build performance of aleo.tools #618

Merged
merged 25 commits into from
Jun 30, 2023

Conversation

onetrickwolf
Copy link
Collaborator

Motivation

Resolves #617

Test Plan

Functionality should be identical but compile time and hot reload should be significantly faster (roughly 50x performance in my tests).

@onetrickwolf
Copy link
Collaborator Author

Currently have new build in website-swc am keeping old website folder separate to easily compare and bench. This branch was also coming off of a branch for #598 will be removing that code before coming out of draft.

@onetrickwolf
Copy link
Collaborator Author

Unfortunately, a bug in vite means we still have to use Webpack for production builds, but this PR is still worth merging considering how much it speeds up the dev server spinup and HMR.

Tracking vite bug here: #628; I will remove the web pack once this bug is resolved.

@onetrickwolf onetrickwolf marked this pull request as ready for review June 24, 2023 20:53
@onetrickwolf
Copy link
Collaborator Author

Some issues with how this deploys to netlify, making a few small changes.

Copy link
Contributor

@collinc97 collinc97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@onetrickwolf onetrickwolf marked this pull request as draft June 26, 2023 21:23
Copy link
Collaborator

@iamalwaysuncomfortable iamalwaysuncomfortable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, I'd say pending the merge of the new fixes upstream, this looks fine to me.

@onetrickwolf
Copy link
Collaborator Author

Okay fixed the vite build.

Had to do a small patch for wasm-bindgen-rayon here: GoogleChromeLabs/wasm-bindgen-rayon@main...onetrickwolf:wasm-bindgen-rayon:main

Patch implemented via root (patches do not work in workspaces apparently) Cargo.toml: https://github.com/AleoHQ/sdk/pull/618/files#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542R23-R25

I attempted to find a solution that would work for both webpack and vite so I could submit it as a PR to wasm-bindgen-rayon but was unable to find a simple one. I may make a PR to them for a feature flag for non-webpack bundlers or something though so we can get off this patch eventually or maybe implement the solution in vite.

@onetrickwolf
Copy link
Collaborator Author

Okay this should be good to go. Decided to go back to the webpack build for now after some more research I am pretty convinced this is actually best solved with a vite patch rather than patching wasm-bindgen-rayon.

Currently deployed to https://staging.aleo.tools/ seems to be fine!

There's a few non-ideal configurations from the hybrid approach but nothing major, still a huge improvement. Hopefully can be cleared up in the near future. In staging will throw that it is missing index.jsx due to a difference in how vite and webpack do entry points but will not affect anything.

@onetrickwolf onetrickwolf marked this pull request as ready for review June 30, 2023 03:05
@onetrickwolf onetrickwolf merged commit 7b1a0b8 into testnet3 Jun 30, 2023
5 checks passed
@onetrickwolf onetrickwolf deleted the feat/website-build-performance branch June 30, 2023 15:28
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.

[Proposal] Improve HMR performance of aleo.tools
3 participants