Skip to content

Optimization Tip

toxicity188 edited this page Dec 30, 2024 · 2 revisions

Since we have a reasonable data of BetterHud's preformance, (From server with over 500 average user)
I want to notice you about BetterHud's performance and how to optimize it.

A summary is here:

- TPS has no issue.
- Network usage is very low.
- CPU usage can be high but it can be optimized.

To optimize CPU usage, you have to follow this:

1. Do not use PAPI unless it is absolutely necessary.
- There are some PAPI expansion that occurring some significant CPU issues. (like Javascript-Expansion)
- PAPI can't be internally optimized (In case, PAPI have to search what this placeholder is in every tick, while BH's built-in placeholder is not.)
- Condition comparison with PAPI is very, very inefficient. (For example, Comparing number is always be met by converting string to number.)

2. Turn off every HUD in AFK users.
- You can always turn on/off HUD by command '/hud turn <on/off> <player>' or method HudPlayer#setHudEnabled
- By default, BH does no provide AFK disabling because Judging what AFK is can be very different by each Minecraft server.

3. Use latest BH as you can.
- I have optimized BH on many times.
- In 1.11, BH's network usage is only 1/3 compare to 1.0.

In optional choice, you can try more optimization by tick configuration:

entity_health_text:
  texts:
    1:
      name: unifont
      pattern: "Health: <#FFD800>[entity_health] // [entity_max_health]"
      placeholder-string-format:
        number: "#,###"
      y: -16
      x: -32
      scale: 0.5
      align: left
      tick: 3 #Component update time (tick)
Clone this wiki locally