Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

miscellaneous optimizations (optimizing at 3am is addicting)#198

Merged
LukynkaCZE merged 10 commits intomasterfrom
misc/optimizations
Jun 30, 2025
Merged

miscellaneous optimizations (optimizing at 3am is addicting)#198
LukynkaCZE merged 10 commits intomasterfrom
misc/optimizations

Conversation

@LukynkaCZE
Copy link
Contributor

I did lot of profiling and addressed some of the most performance heavy stuff

  • Add ObjectPool and make Inflater and Deflater in NetworkCompression pooled to reduce overhead of creating those objects for every tcp frame
  • Optimize reading and writing VarInts
  • Make properties of EventContext lazy since they are rarely accessed anyway and combining sets is expensive
  • Make schematic placing use fastutil maps and sets
  • Don't construct packets for sidebar, bossbar and hologram updates if there are no viewers

There's still more to be addressed at some other point:

  • Consider moving to Native C implementation of cipher (for encryption) and zlib (for compression) like in velocity
  • Look into optimizing string operations in Scroll
  • Look into optimizing string operations in Block#parseBlockStateString
  • Packets are written by Dockyard in a Netty IO Event Loop thread #179 (this also causes the netty thread to block which could cause tiny lag spikes)

@LukynkaCZE LukynkaCZE force-pushed the misc/optimizations branch from 2d323d3 to 222ce42 Compare June 30, 2025 07:23
@LukynkaCZE LukynkaCZE marked this pull request as ready for review June 30, 2025 07:28
@LukynkaCZE LukynkaCZE merged commit 5458f6c into master Jun 30, 2025
3 checks passed
@LukynkaCZE LukynkaCZE deleted the misc/optimizations branch June 30, 2025 07:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants