getsentry / sentry-dotnet

Sentry SDK for .NET
https://docs.sentry.io/platforms/dotnet
MIT License
566 stars 203 forks source link

Regular expressions can now be used for InApp includes/excludes #3321

Closed jamescrosswell closed 1 week ago

jamescrosswell commented 3 weeks ago

Resolves https://github.com/getsentry/sentry-dotnet/issues/3158

jamescrosswell commented 1 week ago

Have you checked the original vs current version in benchmarks manually? Can you please post the results?

@vaind the newer code was actually significantly slower (~40%) so I've tightened it up a bit and now I'm seeing:

main branch

Method N Mean Error StdDev Allocated
ConfigureAppFrame 1000 110.5 us 2.16 us 3.02 us 133.77 KB

inapp-regex branch

Method N Mean Error StdDev Allocated
ConfigureAppFrame 1000 62.92 us 1.249 us 3.064 us 976 B

Which is cool... now it's way faster and allocates way less memory 🥳 I think most of those gains were simply getting rid of Linq, although I did get rid of another lambda as well.