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

SequenceReader performance; elide bounds checks and book-keeping #82765

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
580a164
SequenceReader; elide bounds checks by using ref-oriented approach
mgravell Feb 28, 2023
dfe7241
net6-: don't forget to increment _consumedAtStartOfCurrentSpan
mgravell Feb 28, 2023
481b49c
- don't use the Unsafe or MemoryMarshal evilness
mgravell Mar 1, 2023
a5bf93d
in search, avoid copying out the T value
mgravell Mar 1, 2023
836bc9c
drop unused method
mgravell Mar 1, 2023
4e8d89c
reinstate next position; needed to avoid double-fetch in GetNextSpan
mgravell Mar 1, 2023
f359dd0
use better API to get first span in ResetReader
mgravell Mar 1, 2023
454315e
simplify Position getter
mgravell Mar 1, 2023
d001302
move reset logic to constructor; use constructor in ResetReader
mgravell Mar 1, 2023
4ba4be6
always track consumed span when moving to next, even for single segment
mgravell Mar 1, 2023
ec519f7
for single-segment cases, length is trivial; record length at EOF; up…
mgravell Mar 1, 2023
f6d17c4
use named parameter to clarify meaning
mgravell Mar 1, 2023
7a17388
explicit types (IDE0008)
mgravell Mar 1, 2023
4781155
- fix increment bug at end of single-segment buffers
mgravell Mar 2, 2023
e49b863
simplify advance further
mgravell Mar 2, 2023
11a7b46
remove debug-check from AssertValidPosition() to make the compiler ha…
mgravell Mar 2, 2023
570d221
TryPeek/TryRead: avoid bounds check by hoisting into locals
mgravell Mar 2, 2023
c1c6d59
nit: use local for the addition too (cuts a `mov` from the JIT output)
mgravell Mar 2, 2023
594f879
test fixes
mgravell Mar 2, 2023
892a9e7
Advance: don't short-circuit (we expect both sides to pass)
mgravell Mar 3, 2023
eeb4bff
work around JIT regressions
mgravell Mar 3, 2023
0412ab1
nit: TryGetNextBuffer - defer updating result; empty segments are v.rare
mgravell Mar 7, 2023
e825679
Fix two rebase errors
jozkee Aug 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
drop unused method
  • Loading branch information
mgravell authored and jozkee committed Aug 11, 2023
commit 836bc9c45b40f9aa6b005d2380b608ddf10afe48
Original file line number Diff line number Diff line change
@@ -63,13 +63,6 @@ public readonly SequencePosition Position
/// </summary>
public readonly ReadOnlySpan<T> CurrentSpan => _currentSpan;

private void SetCurrentSpan(ReadOnlySpan<T> span)
{
_consumedAtStartOfCurrentSpan += _currentSpan.Length; // account for previous
_currentSpan = span;
_currentSpanIndex = 0;
}

/// <summary>
/// The index in the <see cref="CurrentSpan"/>.
/// </summary>