-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Stop instantiating Stopwatch #31348
Stop instantiating Stopwatch #31348
Conversation
#if NET7_0_OR_GREATER | ||
=> Stopwatch.GetElapsedTime(startTimestamp); | ||
#else | ||
=> new((long)((Stopwatch.GetTimestamp() - startTimestamp) * StopWatchTickFrequency)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from the .NET 7.0 implementation
@AndriySvyryd @bricelam simplified this thanks to @sharwell's suggestion, will wait in case you want to take another look etc. |
OK, will merge this - let me know retroactively if you see any issues. |
@@ -155,12 +154,12 @@ public override bool NextResult() | |||
{ | |||
stmt = _stmtEnumerator.Current; | |||
|
|||
_timer.Start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 If you're ever interested in adding more of the API, you can reference some old work here:
dotnet/roslyn@ce6b1a9
It wasn't worth the complexity for our uses, so you would make the call. Good to leave a note for future reference though. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sharwell, yeah - I think the current thing more than fits our needs...
Closes #31347
Closes #26295
/cc @vonzshik