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:
@@ -144,6 +144,13 @@ impl ServerAdvancements {
|
|||||||
) -> Option<Vec<u8>> {
|
) -> Option<Vec<u8>> {
|
||||||
let n = self.tree.list.len();
|
let n = self.tree.list.len();
|
||||||
let first = visible.len() != n;
|
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
|
let now = self
|
||||||
.tree
|
.tree
|
||||||
.visible(&self.kids, |i| progress.done(&self.tree.list[i]));
|
.visible(&self.kids, |i| progress.done(&self.tree.list[i]));
|
||||||
|
|||||||
Reference in New Issue
Block a user