-
Notifications
You must be signed in to change notification settings - Fork 277
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
Add benchmarks for ZipFile.CreateFromDirectory
and ZipFile.ExtractToDirectory
#4764
base: main
Are you sure you want to change the base?
Conversation
…file containing the files inside the existing TestData folder.
…pruning dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carlossanlop thank you for providing more benchmarks! PTAL at my comments.
|
||
public void ZipFileExtractToDirectory() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was that supposed to be a benchmark too?
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))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How long does it take to run this benchmark? We usually avoid [IterationSetup]
for the reasons described here:
Does ZipFile.CreateFromDirectory
overwrite the file?
@@ -118,6 +118,9 @@ | |||
<None Update="libraries\System.IO.Compression\TestData\**"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</None> | |||
<None Update="libraries\System.IO.Compression\TestZipFile.zip"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. 👍
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.