Skip to content

[Proto] Make Lookup class fully rva-static#100

Merged
Linwenxuan04 merged 3 commits into
mainfrom
feature/make-lookup-rva-static
Mar 20, 2026
Merged

[Proto] Make Lookup class fully rva-static#100
Linwenxuan04 merged 3 commits into
mainfrom
feature/make-lookup-rva-static

Conversation

@Executor-Cheng
Copy link
Copy Markdown
Contributor

Make Lookup class fully rva-static. This gives the JIT more opportunities to optimize.

Copilot AI review requested due to automatic review settings March 20, 2026 02:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Lookup tables used by ProtoReader varint decoding to be represented as RVA-backed data (via ReadOnlySpan/collection expressions) rather than runtime-initialized arrays, aiming to enable better JIT optimization.

Changes:

  • Replaced Lookup.DoubleVec runtime initialization with an RVA-backed ReadOnlySpan<Vector128<sbyte>> over a byte blob.
  • Replaced Lookup.DoubleStep1 with an RVA-backed byte blob and a MemoryMarshal.Cast-produced span for lookup entries.
  • Updated ProtoReader.DecodeTwo32VarIntUnsafe to index the new span-based tables and retrieve shuffle vectors via Unsafe.Add.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Lagrange.Proto/Primitives/ProtoReader.cs Switched lookup/shuffle table access to the new span-based Lookup representation.
Lagrange.Proto/Primitives/Lookup.cs Converted decode lookup tables to RVA-backed ReadOnlySpan data and exposed them via MemoryMarshal.Cast.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Lagrange.Proto/Primitives/Lookup.cs Outdated
Comment thread Lagrange.Proto/Primitives/Lookup.cs Outdated
Comment thread Lagrange.Proto/Primitives/ProtoReader.cs
@Linwenxuan04 Linwenxuan04 merged commit 4b7ee32 into main Mar 20, 2026
12 checks passed
@Executor-Cheng Executor-Cheng deleted the feature/make-lookup-rva-static branch March 20, 2026 06:47
Bemly pushed a commit to Bemly/CharonAnchor that referenced this pull request May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants