Holographic Displays

Holographic Displays

3M Downloads

Placeholders

RobiRami opened this issue ยท 4 comments

commented

Placeholders are pretty inefficient in a lot of ways.
First of all it isn't possible to register a placeholder after server startup. While trying this, the newly added placeholder does not get replaced.

Second of all, all placeholder result values are getting requested constantly, even if there's no active hologram with that placeholder.

commented

Please check out the new beta version. Placeholders are only updated when there is at least a player to view them.

commented

Yes, HolographicDisplays is doing placeholders very inefficiently, and many server owners could really benefit from some simple rework.

For example, I have HD installed with LeaderHeads, and HD is constantly using 1 ms cpu time every other tick. And I don't even have any holograms defined yet!

If HD is requesting updates for EVERY placeholder from LeaderHeads every other tick, then that is a huge waste of valuable cpu time. You could vastly improve this by adding a simple "inUse" boolean to each placeholder. At load/reload, you scan all the HD text lines to see if a placeholder is in use, and, if so, set inUse to true for that placeholder. Upon creation of new holograms, you do likewise for all placeholders in the new hologram. Don't worry about hologram deletion and marking inUse false -- that can be covered by a reload or server restart. Then, when PlaceholdersManager runs every other tick, have it only request updates for placeholders that have inUse == true.

Please, please implement something like this or some other optimization that you think will solve this issue. I like the HolographicDisplays plugin, but I hate wasted cpu cycles and inefficient plugins even more. As of now, I have removed the HD plugin until this issue is resolved. And I'm recommending other server owners do the same.

commented

Any news about this?

commented

@RobiRami you can add placeholders after runtime. We are doing it here:
https://github.com/redstone/LegacyFactions/blob/master/src/main/java/net/redstoneore/legacyfactions/placeholder/adapter/AdapterHolographicDisplays.java#L25

In regards to being concerned about placeholders getting updated when they aren't in use, perhaps a placeholders update should be able to go into "sleep mode" or something like that when it has not been requested for a while.