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

Improve pnp loader speed and memory: jszip implementation #6688

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

goloveychuk
Copy link
Contributor

@goloveychuk goloveychuk commented Feb 14, 2025

What's the problem this PR addresses?

rework of #6671
TODO:

  • check security?
  • tests
  • elaborate mixed compression logic
  • benchmarks?
  • hide exports and interfaces for external consumers?

...

How did you fix it?

...

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@goloveychuk goloveychuk force-pushed the minizip2 branch 2 times, most recently from 8c5a405 to 5a847fd Compare February 23, 2025 14:03
@goloveychuk goloveychuk changed the title jsZip implementation Improve pnp loader speed and memory: jszip implementation Feb 23, 2025
@goloveychuk
Copy link
Contributor Author

goloveychuk commented Feb 23, 2025

@arcanis review pls.
Todo:

  1. have question about one test libzip/incons-file-count-overflow.zip
  2. need benchmark?
  3. mixed compression logic should be checked

@goloveychuk
Copy link
Contributor Author

@merceyz @RDIL maybe you want to review?

@goloveychuk
Copy link
Contributor Author

@arcanis if you want I can move jszip implementation into my repo, and add as external dependency from berry.

Comment on lines +96 to +100
minizip: {
description: `Whether Yarn should use minizip to extract archives`,
type: SettingsType.BOOLEAN,
default: false,
},
Copy link
Member

Choose a reason for hiding this comment

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

Since the main benefit of this PR is to decrease the runtime footprint (by comparison the install doesn't have a lot to gain, since only unplugged packages are extracted on the disk and there's very little of them), I'd rather keep the existing codepath for unplug (to simplify the changes as much as possible).

@@ -115,6 +123,15 @@ const plugin: Plugin<CoreHooks & StageHooks> = {
default: [],
isArray: true,
},
experimentalZipImplementation: {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
experimentalZipImplementation: {
pnpZipImplementation: {

entries.push({
name,
os,
mtime: 0, //we dont care,
Copy link
Member

Choose a reason for hiding this comment

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

We use 456789000 (see SAFE_TIME)

}

export class ZipFS extends BasePortableFakeFS {
private readonly libzip: Libzip;
export interface ZipImpl {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Can you move it to a ZipImplementation.ts file?

@arcanis
Copy link
Member

arcanis commented Mar 1, 2025

Hey @goloveychuk! No it's fine, I prefer to have it inside this repository at least as long as it's experimental; I still have to review this PR, it's pretty large (even discounting the test artifacts) and I've been extremely busy at work since the beginning of the year. I'll try to finish the review by next week.

@goloveychuk
Copy link
Contributor Author

Thank you.
Tests could be rewritten from snapshot file to inline snapshots or code which defines expected files list.

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