-
Notifications
You must be signed in to change notification settings - Fork 5k
Implement SequenceReader.TryPeek(long offset, out T value) #42364
Conversation
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 for tackling this! I'd optimize for peeking within the current span, then fall back to using the internal TryCopyMultisegment
as discussed inline.
The key design point is to make any in span operations as fast as possible. When we cross spans we should still try to be efficient, but it is okay to not be micro-optimized and favor code-reuse / clarity.
Thank you for your contribution. As announced in dotnet/coreclr#27549 this repository will be moving to dotnet/runtime on November 13. If you would like to continue working on this PR after this date, the easiest way to move the change to dotnet/runtime is:
|
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.
Sorry about the unnecessary confusion. Looks good with just some minor issues with comments (notably capitalizing the first word). You should also be validating that we get default
out when the method returns false.
@JeremyKuhne ready to review, I'll take some other api after that. |
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!
Awesome! |
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.
Some late review nits.
thank's @ahsonkhan for review...bit busy days I'll take a look starting in middle of next week if it's not a problem, it's on my backlog now. |
Closes https://github.com/dotnet/corefx/issues/40845
cc: @JeremyKuhne