Commit 7e34fba
feat: Optimize ServerWaypointManager when locator bar is disabled
The waypoint system iterates over each player for running waypoint calculations. This, most notably, is done on setPosRaw which is executed twice for each player (one for non players).
This results in every time a player moves, it iterates over each player twice.
So instead, we cache the game rule and instead use this to prevent iterating over all the players and avoid the redundant connection logic checks.
This performance issue is most noticeable with many players on the same level.1 parent 9d2db14 commit 7e34fba
4 files changed
Lines changed: 83 additions & 6 deletions
File tree
- paper-server/patches
- features
- sources/net/minecraft/server
- level
- waypoints
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23838 | 23838 | | |
23839 | 23839 | | |
23840 | 23840 | | |
23841 | | - | |
| 23841 | + | |
23842 | 23842 | | |
23843 | 23843 | | |
23844 | 23844 | | |
| |||
27004 | 27004 | | |
27005 | 27005 | | |
27006 | 27006 | | |
27007 | | - | |
| 27007 | + | |
27008 | 27008 | | |
27009 | 27009 | | |
27010 | 27010 | | |
| |||
27400 | 27400 | | |
27401 | 27401 | | |
27402 | 27402 | | |
27403 | | - | |
| 27403 | + | |
27404 | 27404 | | |
27405 | 27405 | | |
27406 | 27406 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1533 | 1533 | | |
1534 | 1534 | | |
1535 | 1535 | | |
1536 | | - | |
| 1536 | + | |
1537 | 1537 | | |
1538 | 1538 | | |
1539 | 1539 | | |
| |||
1543 | 1543 | | |
1544 | 1544 | | |
1545 | 1545 | | |
| 1546 | + | |
1546 | 1547 | | |
1547 | 1548 | | |
1548 | 1549 | | |
| |||
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
245 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
246 | 250 | | |
247 | 251 | | |
248 | 252 | | |
| |||
Lines changed: 72 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
0 commit comments