Skip to main content
Low-level performance primitives in the 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 for System.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 bitmap readonly 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.
EqualsIgnoreCase handles ASCII letters only (A-Z / a-z). It does not perform Unicode case folding. Use it for protocol tokens, not user-facing text.

SpanHelpers

Span utilities missing from netstandard2.0: counting, multi-value search, and whitespace checks.

IntegerParser

Zero-allocation integer parsing from ReadOnlySpan<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.
ref struct — cannot be stored in fields, captured by lambdas, or used across await boundaries.

MemoryHelpers

Typed wrappers around MemoryMarshal for span reinterpretation.

See Also

  • Polyfills — language feature polyfills for netstandard2.0
  • Code GenerationEquatableArray, HashCombiner, IndentedStringBuilder
  • Guard — argument validation with aggressive inlining