-
Notifications
You must be signed in to change notification settings - Fork 272
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
Port System.Drawing benchmarks from CoreFX #350
Conversation
Part of #344 |
@JeremyKuhne @ViktorHofer could you please take a look? this is a port from xunit-performance to BenchmarkDotNet, git blame tells me that you are the most familiar people with these benchmarks :D You can ignore the failed ARM build, it's due to #333 |
@@ -61,4 +62,8 @@ | |||
<Compile Remove="corefx\System.Security.Cryptography\Perf.Rfc2898DeriveBytes.cs" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'"> |
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.
the API is not available for .NET Core 2.0
|
||
static Perf_Color() | ||
{ | ||
AllKnownColors = new[] |
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.
the original benchmark was using reflection to read that https://github.com/dotnet/corefx/blob/9940166bff52155600f25f15da13a83c982526d2/src/System.Drawing.Primitives/tests/Performance/Perf_Color.cs#L18-L22
I want to add CoreRT runs soon, so I did remove the reflection. There is also a chance (very small ofc) that in the future we might add new colors to System.Drawing.Color
which would be simply seen as a regression (the array would grow and the time as well)
_point3 = new Point(35, 5); | ||
_point4 = new Point(50, 10); | ||
|
||
_points = new[] {_point1, _point2, _point3, _point4}; |
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.
the old benchmarks were using 4 random points for DrawBezier_Point
and array of 7 different points for DrawBezier_Points
I unified that to make sure that we compare apples to apples (same points)
new ImageTestData(ImageFormat.Jpeg), | ||
new ImageTestData(ImageFormat.Png), | ||
new ImageTestData(ImageFormat.Gif) | ||
}; |
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.
the old benchmarks were most probably by accident using only Bmp
, I have fixed that
graphics.DrawBezier(pen, RandomPoint(), RandomPoint(), RandomPoint(), RandomPoint()); | ||
} | ||
|
||
bitmap.Save(result, format); |
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.
the old benchmarks were writing to file
to avoid multimodality of the benchmarks (possibly introduced by disk IO) I decided to use MemoryStream
instead.
} | ||
|
||
[Benchmark] | ||
[AllowedOperatingSystems("Graphics.TransformPoints is not implemented in libgdiplus yet. See dotnet/corefx 20884", OS.Windows)] |
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.
this is the only benchmark that can't run on the OSes that we test (Windows RS4, Ubuntu 16.04)
there were some other conditional benchmarks that would not run for Ubuntu 14.04 and other Unixes but we don't test those OSes in our lab so I did not port those conditions
No description provided.