Potentially HUGE optimisation: Read/write to the scoreboard using the *saved* life count not the scoreboard one #3

Open
opened 2022-03-18 23:06:09 +00:00 by TheTechRobo · 1 comment
Owner

Right now, each scoreboard is stored in a <String, Scoreboard> HashMap. This is a remnant of when the life count wasn't persisted on server reboots. Now we can just generate the scoreboards on-the-fly whenever they're updated, using the current life count from the persistent storage. Performance along with RAM impact (i.e. how much we save by not storing each scoreboard separately from Bukkit) should be tested. I have no idea how to do that, though, so could someone that actually knows what they're doing in Java provide some advice?

Right now, each scoreboard is stored in a <String, Scoreboard> HashMap. This is a remnant of when the life count wasn't persisted on server reboots. Now we can just generate the scoreboards on-the-fly whenever they're updated, using the current life count from the persistent storage. Performance along with RAM impact (i.e. how much we save by not storing each scoreboard separately from Bukkit) should be tested. I have no idea how to do that, though, so could someone that actually knows what they're doing in Java provide some advice?
TheTechRobo added the
enhancement
help wanted
labels 2022-03-18 23:06:09 +00:00
Author
Owner

This actually wouldn't lower RAM usage that much. Because we're just storing a pointer to the scoreboard, the only danger of the current strategy is a memory leak - the garbage collector won't run on a scoreboard that Bukkit drops if we still have a pointer to it.

This actually wouldn't lower RAM usage that much. Because we're just storing a pointer to the scoreboard, the only danger of the current strategy is a memory leak - the garbage collector won't run on a scoreboard that Bukkit drops if we still have a pointer to it.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: smp/lifesteal#3
No description provided.