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

Use dotnet 7 regex source generator #568

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dashkan
Copy link

@dashkan dashkan commented Feb 19, 2023

This PR adds support for dotnet 7 regular expression source generators.

Adds significant performance boost.

Since source generators require partial classes, I moved all regular expressions into a single file and wrap the partial methods with a property for simplicity.

I also upgraded all referenced nuget packages to latest.

dotnet 5 is not supported on Apple silicon. I had to also upgrade to dotnet 6.

dotnet 6 benchmark (Not using regex source generator)

// * Summary *

BenchmarkDotNet=v0.13.5, OS=macOS Ventura 13.2.1 (22D68) [Darwin 22.3.0]
Apple M1 Max, 1 CPU, 10 logical and 10 physical cores
.NET SDK=7.0.200
  [Host]     : .NET 6.0.14 (6.0.1423.7309), Arm64 RyuJIT AdvSIMD
  DefaultJob : .NET 6.0.14 (6.0.1423.7309), Arm64 RyuJIT AdvSIMD


|                                                          Method |     Mean |    Error |   StdDev |
|---------------------------------------------------------------- |---------:|---------:|---------:|
|                                                  SingleThreaded | 36.55 ms | 0.712 ms | 0.666 ms |
|                                         ParallelUponDeserialize | 38.59 ms | 0.762 ms | 1.068 ms |
|                                      ParallelUponGetOccurrences | 39.84 ms | 0.700 ms | 0.719 ms |
| ParallelDeserializeSequentialGatherEventsParallelGetOccurrences | 39.17 ms | 0.769 ms | 1.078 ms |

dotnet 7 benchmark (Using regex source generators)

// * Summary *

BenchmarkDotNet=v0.13.5, OS=macOS Ventura 13.2.1 (22D68) [Darwin 22.3.0]
Apple M1 Max, 1 CPU, 10 logical and 10 physical cores
.NET SDK=7.0.200
  [Host]     : .NET 7.0.3 (7.0.323.6910), Arm64 RyuJIT AdvSIMD
  DefaultJob : .NET 7.0.3 (7.0.323.6910), Arm64 RyuJIT AdvSIMD


|                                                          Method |     Mean |    Error |   StdDev |
|---------------------------------------------------------------- |---------:|---------:|---------:|
|                                                  SingleThreaded | 28.01 ms | 0.125 ms | 0.098 ms |
|                                         ParallelUponDeserialize | 33.15 ms | 0.631 ms | 0.751 ms |
|                                      ParallelUponGetOccurrences | 31.07 ms | 0.522 ms | 0.488 ms |
| ParallelDeserializeSequentialGatherEventsParallelGetOccurrences | 32.36 ms | 0.620 ms | 0.806 ms |

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.

None yet

1 participant