Merge pull request #701 from ludovic111/perf/advancements-flush-idle

Server: skip the advancement flush for players whose progress didn't change
This commit is contained in:
Ludovic Marie
2026-10-17 16:30:57 +02:00
committed by GitHub
@@ -144,6 +144,13 @@ impl ServerAdvancements {
) -> Option<Vec<u8>> {
let n = self.tree.list.len();
let first = visible.len() != n;
// flushDirty does nothing unless it is the first packet or progress
// changed: visibility follows progress alone, and every grant and
// revoke is in `changed`. This skips walking the whole tree for
// every player every tick.
if !first && changed.is_empty() {
return None;
}
let now = self
.tree
.visible(&self.kids, |i| progress.done(&self.tree.list[i]));