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

Improved performance. #7

Merged
merged 5 commits into from
Feb 18, 2024
Merged

Improved performance. #7

merged 5 commits into from
Feb 18, 2024

Conversation

jscarle
Copy link
Owner

@jscarle jscarle commented Feb 18, 2024

BenchmarkDotNet v0.13.12, Windows 11 (10.0.22631.3155/23H2/2023Update/SunValley3)
13th Gen Intel Core i7-13700KF, 1 CPU, 24 logical and 16 physical cores
.NET SDK 8.0.200
  [Host]     : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX2
  DefaultJob : .NET 8.0.2 (8.0.224.6711), X64 RyuJIT AVX2
  Iterations : 100 000
Method Before After Difference Before After Difference
ResultBase.Errors[0] 51.91 μs 27.53 μs 89% faster - - No change
ResultBase.HasError<IError>() 4,839.80 μs 94.39 μs 5027% faster 12.21 MB - Eliminated
Result.Ok() 168.40 μs 18.77 μs 797% faster 2.29 MB - Eliminated
Result.Fail() 1,195.60 μs 18.88 μs 6233% faster 12.21 MB - Eliminated
Result.Fail(IError) 1,029.60 μs 535.76 μs 92% faster 9.16 MB 7.63 MB 17% less
Result.Ok<TValue>(TValue) 195.30 μs 196.74 μs No change 3.05 MB 3.05 MB No change
Result.Fail<TValue>() 1,251.30 μs 19.06 μs 6465% faster 12.97 MB - Eliminated
Result.Fail<TValue>(IError) 1,013.10 μs 558.52 μs 81% faster 9.92 MB 8.39 MB 15% less
Result<TValue>.Ok(TValue) 196.30 μs 192.23 μs No change 3.05 MB 3.05 MB No change
Result<TValue>.Fail() 1,225.40 μs 19.04 μs 6336% faster 12.97 MB - Eliminated
Result<TValue>.Fail(IError) 1,018.30 μs 575.66 μs 77% faster 9.92 MB 8.39 MB 15% less
new Error() 225.80 μs 223.80 μs No change 3.05 MB 3.05 MB No change
new Error(errorMessage) 224.40 μs 225.02 μs No change 3.05 MB 3.05 MB No change

On average 1938% faster with 61% less allocations.

@jscarle jscarle merged commit 67c8d60 into main Feb 18, 2024
2 checks passed
@jscarle jscarle deleted the feature/improveperf branch February 18, 2024 16:25
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.

1 participant