Benchmark Scoreboard - ShaneBeee/SkBee GitHub Wiki
Important
All benchmarks on this page include the following:
- 50 players online
- Only the test code shown below is used on the server, no other scripts
- Plugins on the server include Skript, SkBee and StressTestBots (used to create fake players to test)
- Spark profilers were run for 60 seconds
This scoreboard updates all players every tick.
This is generally not a good way to do it for multiple reasons:
- Every tick is a bit (ok a LOT) overkill
- We're setting lines of a scoreboard that aren't even changing
Code
on join:
# this is just to setup our fake scores
set {-var::one::%uuid of player%} to 1
set {-var::two::%uuid of player%} to 2
set {-var::three::%uuid of player%} to 3
set {-var::four::%uuid of player%} to 4
every tick:
loop all players:
set title of fastboard of loop-player to "this is a title"
set line 1 of fastboard of loop-player to "&7Player:"
set line 2 of fastboard of loop-player to name of loop-player
set line 3 of fastboard of loop-player to "Points:"
set line 4 of fastboard of loop-player to "&7- &b%{-var::one::%uuid of loop-player%}%"
set line 5 of fastboard of loop-player to "Score:"
set line 6 of fastboard of loop-player to "&7- &b%{-var::two::%uuid of loop-player%}%"
set line 7 of fastboard of loop-player to "KDR:"
set line 8 of fastboard of loop-player to "&7- &b%{-var::three::%uuid of loop-player%}%"
set line 9 of fastboard of loop-player to "Blerp:"
set line 10 of fastboard of loop-player to "&7- &b%{-var::four::%uuid of loop-player%}%"
set line 11 of fastboard of loop-player to "IP: play.myserver.com"Here is how that code affects the server. Not too bad, but could be better.
(Averaging 7.8% of the server's tick)

This way to do scoreboards spreads out the work load a bit.
Code
on join:
while player is online:
set title of fastboard of player to "this is a title"
set line 1 of fastboard of player to "&7Player:"
set line 2 of fastboard of player to name of player
set line 3 of fastboard of player to "Points:"
set line 4 of fastboard of player to "&7- &b%{-var::points::%uuid of player%}%"
set line 5 of fastboard of player to "Score:"
set line 6 of fastboard of player to "&7- &b%{-var::score::%uuid of player%}%"
set line 7 of fastboard of player to "KDR:"
set line 8 of fastboard of player to "&7- &b%{-var::kdr::%uuid of player%}%"
set line 9 of fastboard of player to "Blerp:"
set line 10 of fastboard of player to "&7- &b%{-var::blerp::%uuid of player%}%"
set line 11 of fastboard of player to "IP: play.myserver.com"
wait 1 tickOuchie momma! This one is even higher than the previous one, nearly twice as stressful.
This would be caused due to a massive amount of waits (internally these are scheduled tasks).
(Averaging 19.13% of the server's tick)

This way to do scoreboards spreads out the work load a bit.
This is very much the same as a while loop scoreboard, but using SkBee's repeating while loop.
Each while loop has 1 scheduler, vs the other method which creates a new scheduler for every wait 1 tick.
Code
on join:
while player is online repeating every 1 tick:
set title of fastboard of player to "this is a title"
set line 1 of fastboard of player to "&7Player:"
set line 2 of fastboard of player to name of player
set line 3 of fastboard of player to "Points:"
set line 4 of fastboard of player to "&7- &b%{-var::points::%uuid of player%}%"
set line 5 of fastboard of player to "Score:"
set line 6 of fastboard of player to "&7- &b%{-var::score::%uuid of player%}%"
set line 7 of fastboard of player to "KDR:"
set line 8 of fastboard of player to "&7- &b%{-var::kdr::%uuid of player%}%"
set line 9 of fastboard of player to "Blerp:"
set line 10 of fastboard of player to "&7- &b%{-var::blerp::%uuid of player%}%"
set line 11 of fastboard of player to "IP: play.myserver.com"This one looks like it's worse than the while loop version, but this one is better.
SkBee and Skript are actually sharing the same metric here.
(Averaging 10.97% of the server's tick)

In this version, we have created a scoreboard function and only update it when something on the scoreboard actually needs updating.
Code
function updateBoard(p: player):
set title of fastboard of {_p} to "this is a title"
set line 1 of fastboard of {_p} to "&7Player:"
set line 2 of fastboard of {_p} to name of {_p}
set line 3 of fastboard of {_p} to "Points:"
set line 4 of fastboard of {_p} to "&7- &b%{-var::points::%uuid of {_p}%}%"
set line 5 of fastboard of {_p} to "Score:"
set line 6 of fastboard of {_p} to "&7- &b%{-var::score::%uuid of {_p}%}%"
set line 7 of fastboard of {_p} to "KDR:"
set line 8 of fastboard of {_p} to "&7- &b%{-var::kdr::%uuid of {_p}%}%"
set line 8 of fastboard of {_p} to "Blerp:"
set line 10 of fastboard of {_p} to "&7- &b%{-var::blerp::%uuid of {_p}%}%"
set line 11 of fastboard of {_p} to "IP: play.myserver.com"
on join:
updateBoard(player)
on break:
add 1 to {-var::blerp::%uuid of player%}
updateBoard(player)
on place:
add 1 to {-var::points::%uuid of player%}
updateBoard(player)
on death of player:
if attacker is a player:
add 1 to {-var::kdr::%uuid of victim%}
add 1 to {-var::score::%uuid of attacker%}
updateBoard(attacker)
updateBoard(victim)As you can see in this image, there are significant performance improvements.
(This one was a bit more difficult to actually benchmark due to the bots not actually breaking blocks or doing anything, but I ran around killing them just so something was happening)
(Averaging 0.43% of the server's tick)
