Conversation
…sionsTests.cs and DiagnosticsSentryOptionsExtensionsTests.cs
bruno-garcia
left a comment
There was a problem hiding this comment.
Nice! Thanks for this PR, the idea makes sense. I realize it's a draft but left some notes already.
Could you please add some benchmarks in https://github.com/getsentry/sentry-dotnet/tree/main/benchmarks ?
src/Sentry.DiagnosticSource/SentryOptionsDiagnosticExtensions.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
I struggled a bit to add the benchmarks as I needed a specific "ColdStart" configuration but here we go:
But it's not so convincing when running it on main to compare:
|
|
Some notes:
|
that's not a bit of time, that's a lot of time for such a simple operation (seemingly). Could use a bit more investigation. |
Yeah but it's due to JIT. |
We looked at it with @bitsandfoxes when profiling this and IIRC it was mainly the |
bruno-garcia
left a comment
There was a problem hiding this comment.
This is quite promising.Once it's out of draft we can test it against feat/4.0.0 to make sure it works fine with AOT
Would be more noticible if we had some "application code" right after Init. That now would get a chance to run before some gets sent into Sentry vs before where it would need everything to bootstrap |
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
|
With latest changes, here are the benchmarks results:
|
bruno-garcia
left a comment
There was a problem hiding this comment.
Great stuff! Thanks @jairbubbles
Prob needs @bitsandfoxes @vaind or @jamescrosswell as some extra check before we can merge but lgtm
|
Those are some serious gains! I'll follow up with a review/merge this tomorrow. |
bitsandfoxes
left a comment
There was a problem hiding this comment.
Let me run this against 4.0.0 before merging to avoid any heartache.
|
Lets merge this and figure out AOT after |
|
Thanks @jairbubbles |
|
Already tested. Works like a charm. No hickups there! |
In some scenarios the time spent in initializing the SDK can be too important. What is tricky is that the init of the SDK is one of the first thing the app do and we're JITing almost everything. Creating a
HttpClient, aRegexis costly...In this pull request I'm experimenting with lazy instanciation so all that JIT time for these types will be spent afterwards.
I'm disabling almost everything to be in the best scenario possible:
Here is the current status:
Compared to main branch:
Let me know what you think!