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

perf: implement lazy load for eszip entities #343

Merged
merged 31 commits into from
Aug 7, 2024

Conversation

nyannyacha
Copy link
Collaborator

@nyannyacha nyannyacha commented May 15, 2024

What kind of change does this PR introduce?

Enhancement

Description

This PR changes the way opaque data is stored in eszip and makes allow lazy-load for individual data stored in eszip.

Sample

import { createClient } from 'npm:@supabase/supabase-js@2.42.0'
console.log(typeof createClient);
Deno.serve((_req) => new Response("Hello, world"));

Metrics (Observed lowest value in local)

Previous This PR Change (%)
Bundle Size 22MiB 6.3MiB -349.2%
Boot Time 1939ms 84ms -2308.3%

Notes

It supports runtime migration for bundles created before this PR. However, performance will revert back to what it was before, so I recommend regenerating the bundle.

@nyannyacha

This comment was marked as outdated.

@nyannyacha nyannyacha force-pushed the perf-eszip branch 8 times, most recently from 9c4b11b to 7ca582e Compare May 21, 2024 23:05
@nyannyacha
Copy link
Collaborator Author

nyannyacha commented May 21, 2024

Note:
Once this PR is merged, it is worth looking closely to ensure that it is completely compatible with the previous implementation.

cc @laktek @andreespirela

@nyannyacha nyannyacha marked this pull request as ready for review May 21, 2024 23:11
@@ -33,22 +35,25 @@ impl DenoCompileFileSystem {
}
}

fn copy_to_real_path(&self, oldpath: &Path, newpath: &Path) -> FsResult<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why removing this function? We could just create an async one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I recall that some of the functions it calls in its function body had their signatures changed to async, so I changed those functions to async due to contagious.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess I could probably make that synchronously again by spawning async functions in the blocking threads

@nyannyacha nyannyacha force-pushed the perf-eszip branch 6 times, most recently from 64965f2 to 31472b8 Compare June 13, 2024 23:54
@nyannyacha nyannyacha force-pushed the perf-eszip branch 5 times, most recently from 8cd543a to 5e8276e Compare June 19, 2024 08:03
@nyannyacha nyannyacha force-pushed the perf-eszip branch 3 times, most recently from 031ab74 to c4d1d21 Compare June 25, 2024 00:51
Copy link
Contributor

@laktek laktek left a comment

Choose a reason for hiding this comment

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

LGTM! Did some testing locally and common scenarios seems to work :)

@nyannyacha nyannyacha merged commit 3f7863b into supabase:main Aug 7, 2024
3 checks passed
Copy link

github-actions bot commented Aug 7, 2024

🎉 This PR is included in version 1.56.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants