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

Micro benchmarks for System.Formats.Tar.TarWriter.WriteEntry #2926

Merged
merged 8 commits into from
May 24, 2023

Conversation

carlossanlop
Copy link
Member

Making sure we have coverage for the scenario of manually creating an TarEntry then writing it to a tar archive using a TarWriter.

@carlossanlop carlossanlop requested a review from jozkee March 9, 2023 23:43
@carlossanlop carlossanlop self-assigned this Mar 9, 2023
Copy link
Member

@jozkee jozkee left a comment

Choose a reason for hiding this comment

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

CI issues are related:

[2023/03/10 00:05:20][INFO] // Found 2 benchmarks:
[2023/03/10 00:05:20][INFO] //   Perf_TarWriter.V7TarEntry_WriteEntry: Job-BHHYZP(PowerPlanMode=00000000-0000-0000-0000-000000000000, InvocationCount=1, IterationCount=1, IterationTime=250.0000 ms, MaxIterationCount=20, MinIterationCount=15, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=0)
[2023/03/10 00:05:20][INFO] //   Perf_TarWriter.PaxTarEntry_WriteEntry_Async: Job-BHHYZP(PowerPlanMode=00000000-0000-0000-0000-000000000000, InvocationCount=1, IterationCount=1, IterationTime=250.0000 ms, MaxIterationCount=20, MinIterationCount=15, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=0)
[2023/03/10 00:05:20][INFO] 
[2023/03/10 00:05:20][INFO] // **************************
[2023/03/10 00:05:20][INFO] // Benchmark: Perf_TarWriter.V7TarEntry_WriteEntry: Job-BHHYZP(PowerPlanMode=00000000-0000-0000-0000-000000000000, InvocationCount=1, IterationCount=1, IterationTime=250.0000 ms, MaxIterationCount=20, MinIterationCount=15, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=0)
[2023/03/10 00:05:20][INFO] // *** Execute ***
[2023/03/10 00:05:20][INFO] // Launch: 1 / 1
[2023/03/10 00:05:20][INFO] // Execute: dotnet 056c3247-89e2-4608-8c3f-8ceca830c6d9.dll --anonymousPipes 230 231 --benchmarkName System.Formats.Tar.Tests.Perf_TarWriter.V7TarEntry_WriteEntry --job "PowerPlanMode=00000000-0000-0000-0000-000000000000, InvocationCount=1, IterationCount=1, IterationTime=250.0000 ms, MaxIterationCount=20, MinIterationCount=15, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=0" --benchmarkId 307 in /datadisks/disk1/work/AAF40954/w/ACD909EC/e/artifacts/bin/MicroBenchmarks/Release/net8.0/056c3247-89e2-4608-8c3f-8ceca830c6d9/bin/Release/net8.0
[2023/03/10 00:05:20][INFO] Failed to set up high priority. Make sure you have the right permissions. Message: Permission denied
[2023/03/10 00:05:20][INFO] // BeforeAnythingElse
[2023/03/10 00:05:20][INFO] 
[2023/03/10 00:05:20][INFO] // Benchmark Process Environment Information:
[2023/03/10 00:05:20][INFO] // Runtime=.NET 8.0.0 (8.0.23.15903), X64 RyuJIT AVX2
[2023/03/10 00:05:20][INFO] // GC=Concurrent Workstation
[2023/03/10 00:05:20][INFO] // HardwareIntrinsics=AVX2,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256
[2023/03/10 00:05:20][INFO] // Job: Job-LULNEY(PowerPlanMode=00000000-0000-0000-0000-000000000000, InvocationCount=1, IterationCount=1, IterationTime=250.0000 ms, MaxIterationCount=20, MinIterationCount=15, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=0)
[2023/03/10 00:05:20][INFO] 
[2023/03/10 00:05:20][INFO] // BeforeActualRun
[2023/03/10 00:05:20][INFO] 
[2023/03/10 00:05:20][INFO] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
[2023/03/10 00:05:20][INFO]  ---> System.ArgumentException: Entry type 'RegularFile' not supported in format 'V7'. (Parameter 'entryType')
[2023/03/10 00:05:20][INFO]    at System.Formats.Tar.TarHelpers.ThrowIfEntryTypeNotSupported(TarEntryType entryType, TarEntryFormat archiveFormat, String paramName)
[2023/03/10 00:05:20][INFO]    at System.Formats.Tar.V7TarEntry..ctor(TarEntryType entryType, String entryName)
[2023/03/10 00:05:20][INFO]    at System.Formats.Tar.Tests.Perf_TarWriter.V7TarEntry_WriteEntry() in /datadisks/disk1/work/AAF40954/w/ACD909EC/e/src/benchmarks/micro/libraries/System.Formats.Tar/Perf.Tar.cs:line 49
[2023/03/10 00:05:20][INFO]    at BenchmarkDotNet.Autogenerated.Runnable_307.WorkloadActionUnroll(Int64 invokeCount) in /datadisks/disk1/work/AAF40954/w/ACD909EC/e/artifacts/bin/MicroBenchmarks/Release/net8.0/056c3247-89e2-4608-8c3f-8ceca830c6d9/056c3247-89e2-4608-8c3f-8ceca830c6d9.notcs:line 56018
[2023/03/10 00:05:20][INFO]    at BenchmarkDotNet.Engines.Engine.RunIteration(IterationData data)
[2023/03/10 00:05:20][INFO]    at BenchmarkDotNet.Engines.EngineStage.RunIteration(IterationMode mode, IterationStage stage, Int32 index, Int64 invokeCount, Int32 unrollFactor)
[2023/03/10 00:05:20][INFO]    at BenchmarkDotNet.Engines.EngineActualStage.RunSpecific(Int64 invokeCount, IterationMode iterationMode, Int32 iterationCount, Int32 unrollFactor)
[2023/03/10 00:05:20][INFO]    at BenchmarkDotNet.Engines.EngineActualStage.Run(Int64 invokeCount, IterationMode iterationMode, Boolean runAuto, Int32 unrollFactor, Boolean forceSpecific)
[2023/03/10 00:05:20][INFO]    at BenchmarkDotNet.Engines.EngineActualStage.RunWorkload(Int64 invokeCount, Int32 unrollFactor, Boolean forceSpecific)
[2023/03/10 00:05:20][INFO]    at BenchmarkDotNet.Engines.Engine.Run()
[2023/03/10 00:05:20][INFO]    at BenchmarkDotNet.Autogenerated.Runnable_307.Run(IHost host, String benchmarkName) in /datadisks/disk1/work/AAF40954/w/ACD909EC/e/artifacts/bin/MicroBenchmarks/Release/net8.0/056c3247-89e2-4608-8c3f-8ceca830c6d9/056c3247-89e2-4608-8c3f-8ceca830c6d9.notcs:line 55919
[2023/03/10 00:05:20][INFO]    at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
[2023/03/10 00:05:20][INFO]    at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
[2023/03/10 00:05:20][INFO]    --- End of inner exception stack trace ---
[2023/03/10 00:05:20][INFO]    at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
[2023/03/10 00:05:20][INFO]    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[2023/03/10 00:05:20][INFO]    at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args) in /datadisks/disk1/work/AAF40954/w/ACD909EC/e/artifacts/bin/MicroBenchmarks/Release/net8.0/056c3247-89e2-4608-8c3f-8ceca830c6d9/056c3247-89e2-4608-8c3f-8ceca830c6d9.notcs:line 57

@danmoseley
Copy link
Member

@carlossanlop is this still in progress

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

BDN runs every benchmark more than once, so we want to reuse the memory stream instance
and have it always perform the same amount of work.

@carlossanlop carlossanlop force-pushed the TarWriter_WriteEntry branch from b37ff41 to 2a6d44d Compare May 23, 2023 02:01
@carlossanlop carlossanlop requested review from adamsitnik and jozkee May 23, 2023 02:02
adamsitnik
adamsitnik previously approved these changes May 23, 2023
Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

Two benchmarks are failing, but I left some comments that should fix the issue.

@carlossanlop thank you for contributing new benchmarks!

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

LGTM, but we are now blocked by #3037 (unrelated to your changes).

@carlossanlop
Copy link
Member Author

Thanks for the explanations and for applying the suggestions, @adamsitnik.

@adamsitnik
Copy link
Member

image

can somebody else approve the PR?

@cincuranet
Copy link
Contributor

@adamsitnik Done.

@adamsitnik adamsitnik merged commit 96f8c60 into dotnet:main May 24, 2023
@adamsitnik
Copy link
Member

@cincuranet thanks a lot!

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

Successfully merging this pull request may close these issues.

6 participants