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 benchmark to measure GetHash #10

Merged
merged 1 commit into from
Jan 30, 2023
Merged

feat: add benchmark to measure GetHash #10

merged 1 commit into from
Jan 30, 2023

Conversation

virzak
Copy link
Contributor

@virzak virzak commented Jan 29, 2023

I noticed that GetHash still uses an object, so tried to add a benchmark and the improvement is significant:

// * Summary *

BenchmarkDotNet=v0.13.4, OS=Windows 11 (10.0.22621.1105)
AMD Ryzen 9 5900HS with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.102
[Host] : .NET 7.0.2 (7.0.222.60605), X64 RyuJIT AVX2
Job-DRNVHW : .NET 7.0.2 (7.0.222.60605), X64 RyuJIT AVX2

Runtime=.NET 7.0 Toolchain=net7.0 IterationCount=3
LaunchCount=1 WarmupCount=3

Method Mean Error StdDev Ratio RatioSD Gen0 Allocated Alloc Ratio
Struct 11.511 ns 7.585 ns 0.4157 ns 0.43 0.04 0.0029 24 B NA
WithLayout 10.225 ns 5.764 ns 0.3160 ns 0.38 0.02 0.0029 24 B NA
WithLayoutNoBoxing 4.158 ns 2.832 ns 0.1552 ns 0.16 0.02 - - NA
Class 26.755 ns 37.681 ns 2.0654 ns 1.00 0.00 - - NA
ClassLayout 25.655 ns 33.121 ns 1.8155 ns 0.97 0.14 - - NA

@virzak virzak mentioned this pull request Jan 29, 2023
@Ne4to Ne4to merged commit ba3c484 into Ne4to:main Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants