Skip to content

perf(network): Improve performance by reducing packet allocations and improving loop logic#2659

Draft
Caball009 wants to merge 6 commits intoTheSuperHackers:mainfrom
Caball009:perf_network
Draft

perf(network): Improve performance by reducing packet allocations and improving loop logic#2659
Caball009 wants to merge 6 commits intoTheSuperHackers:mainfrom
Caball009:perf_network

Conversation

@Caball009
Copy link
Copy Markdown

@Caball009 Caball009 commented Apr 28, 2026

This PR makes modest performance improvements in the networking code by reducing the number of dynamic NetPacket allocations and breaking out loops as early as possible.

See commits for cleaner diffs.

TODO:

  • Check whether it still makes sense to have NetPacket memory pooled.

@Caball009 Caball009 added Minor Severity: Minor < Major < Critical < Blocker Performance Is a performance concern Network Anything related to network, servers labels Apr 28, 2026
@Caball009 Caball009 changed the title perf(network): Improve performancy by reducing packet allocations and improving loop logic perf(network): Improve performance by reducing packet allocations and improving loop logic Apr 28, 2026
@Caball009 Caball009 force-pushed the perf_network branch 2 times, most recently from 7ebd8f1 to a2267a1 Compare April 28, 2026 20:41
@stephanmeesters
Copy link
Copy Markdown

I think it would be nice if we can change the signature of NetPacket from class NetPacket : public MemoryPoolObject to struct NetPacket. The memory pooling right now doesn't really get used, especially with your change? By the looks of it this would mostly need changes around NetPacket::ConstructBigCommandPacketList

@Caball009
Copy link
Copy Markdown
Author

I think it would be nice if we can change the signature of NetPacket from class NetPacket : public MemoryPoolObject to struct NetPacket. The memory pooling right now doesn't really get used, especially with your change? By the looks of it this would mostly need changes around NetPacket::ConstructBigCommandPacketList

Perhaps I can just put the relevant logic from Connection::sendNetCommandMsg in a callback and pass that to NetPacket::ConstructBigCommandPacketList.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Minor Severity: Minor < Major < Critical < Blocker Network Anything related to network, servers Performance Is a performance concern

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants