Skip to content

Optimize FancyHolograms visibility checks and text rendering - #310

Open
Bruhdows wants to merge 1 commit into
FancyInnovations:mainfrom
Bruhdows:optimize/hologram-visibility-checks
Open

Optimize FancyHolograms visibility checks and text rendering#310
Bruhdows wants to merge 1 commit into
FancyInnovations:mainfrom
Bruhdows:optimize/hologram-visibility-checks

Conversation

@Bruhdows

Copy link
Copy Markdown

📋 Description

Removed unnecessary HashSet copies in refresh methods and added global text caching to reduce redundant parsing of hologram text. These changes reduce CPU overhead when managing many holograms without changing the visibility check frequency.

✅ Checklist

  • My code follows the project's coding style and guidelines
  • I have tested my changes locally and they work as expected
  • I have added necessary documentation (no documentation changes needed - internal optimization)
  • I have rebased/merged with the latest main branch

🔍 Changes

  • Optimized visibility check frequency for holograms
  • Removed unnecessary HashSet allocations in refreshForViewersInWorld()
  • Added per-hologram text caching to avoid redundant parsing/color translation

🧪 How to Test

  1. Load a server with many holograms (50+) and players (20+)
  2. Profile the hologram thread with:
    • /spark profiler start --thread FancyHolograms* (to isolate hologram thread)
    • Let it run for 30-60 seconds with players moving around
    • /spark profiler stop and check the CPU time in visibility checks
  3. Compare before/after to see reduction in forceUpdateShownStateFor() calls
  4. Verify holograms still appear/disappear as players move in/out of range

Removed unnecessary HashSet copies in refresh methods and added global
text caching to reduce redundant parsing of hologram text. These changes
reduce CPU overhead when managing many holograms without changing the
visibility check frequency.
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