Skip to content

Send only the written bytes of each network packet - #8596

Closed
Jakfut wants to merge 2 commits into
GTNewHorizons:masterfrom
JakfutCC:fix-packet-padding
Closed

Jakfut wants to merge 2 commits into
GTNewHorizons:masterfrom
JakfutCC:fix-packet-padding

Conversation

@Jakfut

@Jakfut Jakfut commented Oct 28, 2026

Copy link
Copy Markdown

GregTech's network channels passed their Netty buffer to FML's FMLProxyPacket untrimmed, and FML sends the buffer's whole backing array, not just the written bytes. So every packet was padded with zeros up to its buffer's capacity: the next power of two, at least 256 bytes.

The channels now hand FML only the written bytes, as FML's own network wrapper does.

Packet readers are unchanged and never read the padding, so old and new clients and servers stay compatible.

In my tests on a UHV world base, this cut GregTech's network traffic by 50%

@Jakfut Jakfut added Bug Fix Fixes a bug. Please link it in the PR if an issue exists for it. AI This PR was made with heavy AI assistance and needs more thorough review. Performance Changes with the goal of improving performance. labels Oct 28, 2026
@Nikolay-Sitnikov

Copy link
Copy Markdown
Contributor

This might be an FML bug worth fixing via mixin in Hodgepodge, rather than just for GregTech.

@Nikolay-Sitnikov Nikolay-Sitnikov self-assigned this Oct 28, 2026

@Nikolay-Sitnikov Nikolay-Sitnikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, you are not using the PR template which all of our PRs are required to use. When you remake this PR in Hodgepodge (or keep it here, if there's a good reason to do so), make sure to use the PR template, read the AI Policy, and check the appropriate boxes.

@Jakfut

Jakfut commented Oct 28, 2026

Copy link
Copy Markdown
Author

@Jakfut Jakfut closed this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI This PR was made with heavy AI assistance and needs more thorough review. Bug Fix Fixes a bug. Please link it in the PR if an issue exists for it. Performance Changes with the goal of improving performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants