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

feat: add size property to output #672

Merged
merged 6 commits into from Oct 14, 2021
Merged

feat: add size property to output #672

merged 6 commits into from Oct 14, 2021

Conversation

eduardoboucas
Copy link
Member

- Summary

Adds a size property to the output of zipFunction and zipFunctions, containing the number of bytes of the generated archive.

Closes #620.

- Test plan

Added new test.

- A picture of a cute animal (not mandatory but encouraged)

Chinchillas-Great-Pets

@eduardoboucas eduardoboucas added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Sep 24, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Sep 24, 2021

⏱ Benchmark results

Comparing with f756b03

largeDepsEsbuild: 13.8s

⬆️ 9.07% increase vs. f756b03

^                                  13.9s   13.9s                           14.1s   14.2s                  
│  13.6s           13.7s            ┌──┐    ┌──┐                            ┌──┐    ┌──┐   13.5s   13.8s  
│   ┌──┐    13s     ┌──┐            |  |    |  |                   12.8s    |  |    |  |    ┌──┐    ┌──┐  
│ ──┼──┼────┌──┐────┼──┼────────────┼──┼────┼──┼────────────────────┌──┐────┼──┼────┼──┼────┼──┼────|▒▒|──
│   |  |    |  |    |  |            |  |    |  |   11.4s            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |            |  |    |  |    ┌──┐            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |   10.3s    |  |    |  |    |  |   10.1s    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    ┌──┐    |  |    |  |    |  |    ┌──┐    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend

largeDepsZisi: 1m 16.5s

⬆️ 12.09% increase vs. f756b03

^                                                                                 1m 14.8s        1m 16.5s
│                 1m 11.6s        1m 13.5s1m 14.3s                        1m 10.9s  ┌──┐  1m 11.3s  ┌──┐  
│ 1m 10.3s 1m 8s    ┌──┐            ┌──┐    ┌──┐                  1m 7.8s   ┌──┐    |  |    ┌──┐    |▒▒|  
│ ──┌──┐────┌──┐────┼──┼────────────┼──┼────┼──┼────────────────────┌──┐────┼──┼────┼──┼────┼──┼────|▒▒|──
│   |  |    |  |    |  |            |  |    |  |                    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |            |  |    |  |   57.6s            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |   52.9s    |  |    |  |    ┌──┐            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    ┌──┐    |  |    |  |    |  |   50.8s    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend

src/zip.js Outdated
}

const { size } = await lstat(path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we want to use fs.stat() instead of fs.lstat() here?
I'm not sure it can actually ever be a symlink there, but if it was, would we want the size of the symlinked path, or the symlinked content?

Copy link
Member Author

Choose a reason for hiding this comment

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

It won't ever be a symlink in this case because we're opening the ZIP file we're creating ourselves, but I agree that there's no reason to use lstat. I replaced it with stat in 6a75c74.

@eduardoboucas eduardoboucas merged commit c4b41ab into main Oct 14, 2021
@eduardoboucas eduardoboucas deleted the feat/size-property branch October 14, 2021 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add size property to output of zipFunction and zipFunctions
3 participants