Add benchmarks for ZipFile.CreateFromDirectory and ZipFile.ExtractToDirectory#4764
Closed
carlossanlop wants to merge 2 commits intodotnet:mainfrom
carlossanlop:ZipFileBenchmark
Closed
Add benchmarks for ZipFile.CreateFromDirectory and ZipFile.ExtractToDirectory#4764carlossanlop wants to merge 2 commits intodotnet:mainfrom carlossanlop:ZipFileBenchmark
ZipFile.CreateFromDirectory and ZipFile.ExtractToDirectory#4764carlossanlop wants to merge 2 commits intodotnet:mainfrom
carlossanlop:ZipFileBenchmark
Conversation
…file containing the files inside the existing TestData folder.
…pruning dependencies.
This was referenced Mar 12, 2025
adamsitnik
reviewed
Mar 20, 2025
Member
adamsitnik
left a comment
There was a problem hiding this comment.
@carlossanlop thank you for providing more benchmarks! PTAL at my comments.
Comment on lines
+37
to
+38
|
|
||
| public void ZipFileExtractToDirectory() |
Member
There was a problem hiding this comment.
Was that supposed to be a benchmark too?
Suggested change
| public void ZipFileExtractToDirectory() | |
| [Benchmark] | |
| public void ZipFileExtractToDirectory() |
| private static readonly string _testInputZipFile = Path.Combine( | ||
| AppContext.BaseDirectory, "libraries", "System.IO.Compression", "TestInputZipFile.zip"); | ||
|
|
||
| [IterationSetup(Target = nameof(ZipFileCreateFromDirectory))] |
Member
There was a problem hiding this comment.
How long does it take to run this benchmark? We usually avoid [IterationSetup] for the reasons described here:
Does ZipFile.CreateFromDirectory overwrite the file?
| <None Update="libraries\System.IO.Compression\TestData\**"> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| </None> | ||
| <None Update="libraries\System.IO.Compression\TestZipFile.zip"> |
Member
There was a problem hiding this comment.
I was thinking about suggesting to just zip TestData during [GlobalSetup] but then I've realized that if somebody adds new file to TestData, the time reported by the benchmark is going to report a regression.
So please keep the zip file. 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also added a test zip file containing the files inside the existing TestData folder.
Will soon use this class for the async versions of these methods.