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

Do more speculative VarInt reading optimizations #1418

Merged
merged 5 commits into from
Sep 5, 2024

Conversation

astei
Copy link
Contributor

@astei astei commented Sep 1, 2024

Specifically, I tweaked MinecraftVarintFrameDecoder a little bit, and added some logic to unroll the first iteration of ProtocolUtils.readVarInt() if we can.

I haven't evaluated the performance of these changes.

Specifically, I tweaked `MinecraftVarintFrameDecoder` a little bit, and added some logic to unroll the first iteration of `ProtocolUtils.readVarInt()` if we can.

I haven't evaluated the performance of these changes.
The primary change was restricting the VarInt reads from the full 35-bit range to the truncated 21-bit range Minecraft uses for packet framing. As a result we can remove the five-byte VarInt special case.

The unrolled 3-byte read would also be sufficient to read packets, but it doesn't hurt to try and squeeze out some extra performance.
@astei astei merged commit 7848068 into dev/3.0.0 Sep 5, 2024
2 checks passed
@astei astei deleted the astei/speculative-varint-optimizations branch September 5, 2024 04:00
pull bot pushed a commit to WiIIiam278/Velocity that referenced this pull request Sep 6, 2024
jonesdevelopment added a commit to jonesdevelopment/sonar that referenced this pull request Sep 6, 2024
jonesdevelopment added a commit to jonesdevelopment/NanoLimbo that referenced this pull request Sep 21, 2024
BluSpring pushed a commit to CrunchMunchCreations/NanoLimbo that referenced this pull request Nov 22, 2024
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.

1 participant