ANcpLua.Roslyn.Utilities.Performance namespace. All types target netstandard2.0 and use the same algorithms found in the .NET runtime, Kestrel, and System.Text.Json internals.
BitHelpers
Software polyfills forSystem.Numerics.BitOperations (unavailable on netstandard2.0). Hamming weight, De Bruijn sequences, and standard bit-twiddling — the JIT can replace these with hardware intrinsics on modern runtimes.
AsciiSet
128-bit bitmapreadonly struct for O(1) ASCII character membership. Replaces branchy if (c == 'a' || c == 'b' || ...) chains with a single bit-test. Two ulong fields, 16 bytes on the stack.
AsciiHelpers
Branchless ASCII operations. The|= 0x20 trick folds uppercase to lowercase in a single OR — no branch, no table.
SpanHelpers
Span utilities missing fromnetstandard2.0: counting, multi-value search, and whitespace checks.
IntegerParser
Zero-allocation integer parsing fromReadOnlySpan<char> and ReadOnlySpan<byte> with overflow detection. Handles optional leading sign.
Uses
ulong accumulation with per-digit overflow checks. Correctly handles
int.MinValue and long.MinValue (the asymmetric negative bound).SpanTokenizer
ref struct allocation-free tokenizer that splits ReadOnlySpan<char> on a separator. Supports foreach via duck-typed enumerator — no IEnumerable, no boxing, no heap.
MemoryHelpers
Typed wrappers aroundMemoryMarshal for span reinterpretation.
See Also
- Polyfills — language feature polyfills for
netstandard2.0 - Code Generation —
EquatableArray,HashCombiner,IndentedStringBuilder - Guard — argument validation with aggressive inlining
