2,458 Commits over 608 Days - 0.17cph!
Merge: from jobs2_demos_fix
- Bugfix for players not moving in client demos recorded on Jobs 2 servers
Tests: recorded on craggy with jobs 2, played back - all's gud
Bugfix: fix player not moving in demos recorded on Jobs 2 servers
The cached list of unoccluded players was missing owner player
Tests: recorded a demo on craggy with jobs 2, played back - player and camera was moving
Merge: from useplayerupdatejobs3/free_tasks
- New: fork of Cysharp/UniTask with less allocs
- Optim: reduce allocs around tasks in Jobs 3 mode
Tests: jobs3 on craggy with 2 players, built client and booted
Optim: Jobs 3 - save allocs by using UniTask for sending entity snapshots asynchonously
Think that's all existing tasks converted
Tests: loaded on craggy and teleported to/from the island
Clean: get rid of handwritten UpdateSubs_AsyncState state machine
Tests: unit tests
Optim: Jobs 3 - rewrite EAC and analytics tasks into UniTasks to remove allocs
Discovered server profiler is megaborked, no idea what caused it. Will investigate after rewrite is done
Tests: craggy in editor with jobs 3
Optim: Jobs 3 - OcclusionSendUpdates now uses UniTasks
- added UseUniTasks feature flag controlled by UsePlayerUpdateJobs 3
Positive experiemnt, can get rid of the hand-rolled state machine and use async-await.
Tests: profiled 2 players in editor beign destroyed by server occlusion - no allocs for task
Update: server enables SetPoolRunnersActive to reduce allocs of SwitchToThreadPoolAwaitable during tier0 init
Tests: loaded on craggy (with and without jobs 3), teleported around
Optim: UpdateSubscriptions - replace Tasks with UniTasks
They're slightly slower on a stress test, but they allocate an order less (and sometimes don't allocate) - 0.5MB vs 8KB over 10 run
Tests: unit tests
Update: plug in our fork of UniTask
- ecb0489
It has reduced allocations, but there are still some APIs that allocate
Tests: unit tests pass
Optim: FPTask.Run is now 0 allocs
Using reflection, manually invoke internals while sneaking in our cached callback
Tests: ran unit test
Update: add UniTask for evaluation
In simle case only has 1 alloc that's not pooled, same as FPTask - will try to solve it locally first
Tests: ran unit test
Update: basic FPTask + dumb single task scheduler
This gives us 1 alloc/40bytes per task baseline, but with a bit of hacking I think can bring it to 0
Tests: ran unit test
Update: more research - looks like we do need our own task type
Tests: uni tests
Update: initial investigation trying to reduce async-await gc overhead
Goal is to find better alternative to custom async states I've been handwriting, as they still require an alloc per task
Tests: ran unit test
Bugfix(tests): fix invalid position logic in ServerOcclusionGroup tests
Tests: unit tests pass
Merge: from defer_tick_analytics
- Optim: start analytics tasks earlier to avoid blocking main thread
Tests: Jobs3 on craggy in editor
Update: bring back pooling for ApplyChangesParallel_AsyncState
Theorising it'll be safer for hot-reload/manual domain reload flow
Tests: craggy with jobs 3
Update: skip creating analytics task if analytics is disabled
Tests: none, trivial change
Optim: Jobs 3 - kick off analytics tasks earlier in the frame to avoid potentially blocking main thread
It will overlap with server occlusion, which sohuld give it extra time to finish.
Tests: none, trivial change
Update: replace couple managed accesses with BasePlayer.CachedState
Tests: none, trivial change
Optim: save on action alloc when setting up tasks for UpdateSubs_AsyncState
Tests: none, trivial change
Merge: from updatesubs_optim
- Optim: player subscriptions can be updated in parallel (Jobs 3 feature, currently disabled)
- New: unit & perf tests for net group updating
Tests: unit tests
Update: disable parallel sub updates in Jobs 3 mode
- ripped out test code for network grid preallocing
Going to enable it once dependent work is done.
Tests: unit tests fail (as expected)
Optim: schedule tasks for batches of networkables, instead of individual ones
Helps reduce alloc pressure at high counts(2x more than core count), but it's a very rare occasion (when everyone rushes to connect to a fresh server)
Tests: unit tests
Update: skip calling UpdateSubscriptions with 0 networkables
Tests: none, trivial change
Optim: main thread integrates results from subs gathering tasks while waiting for them to complete
Tests: unit tests
Optim: allow main thread to steal one of tasks update subscription tasks
Makes single-player path alloc free.
Tests: unit tests
Optim: use persistent added/removed lists instead of pooled ones
Tests: ran unit tests
Merge: from sv_occlgroups_fix_reinit
- Bugfix for ServerOcclusionGroups NRE for players with custom init flow
- Unit tests
Tests: ran unit tests
Merge: from serverprofiler_linux_fix
- Bugfix for server profiler recoirding empty streams or infinitely recording on Linux
Tests: perfsnapshot on Ubuntu
Bugfix: ServerProfiler - fix profiler failing to record due to uninitialized variable
- release bins built from fe80de3c
Tests: ran perfsnapshot on a server on ubuntu 20.04 in wsl
Update: replicate hardcoded network grid logic into data setup of NetworkVisibilityGrid
- added PositionToGridInd, but not used/tested
Going to add grids visualization next
Tests: none
Update(tests): add 8 players perf test to UpdateSubscriptions
- add some TimeWarnings to parallel UpdateSubscriptions
- got rid of caching all Visible sets, just reuse 1 per task from pool
Tests: ran tests
Update(tests): Pump up those rookie network streaming range numbers in unit tests (1,2 -> 4,8) to match real servers
- rewrote spawning logic in UpdateSubscriptions unit tests to ensure we spawn within main layer
128 player perf test is now showing much better results: Serial - 10.3ms, Parallel - 1.7ms
Tests: ran unit tests
Optim: run gather network groups in parallel
- changed dimensions of net grid in DummyServer, now it's using a 512 grid with 64 cells
128 players: 0.54ms vs 1.15ms of serial. Relies on a prealloc hack, need to support it properly
Tests: ran unit tests
Bugfix: ServerOcclusionGroups - handle null net group when player goes through custom flow
- renamed branch to *_reinit (as limit networking turned out not to be related at all)
Tests: ran all unit tests, they pass
Update(tests): ServerOcclusionGroups - add a net-group reinit test
Not a flow we have on servers for now, but it could change in the future
Tests: new tests fail (as expected)
Merge: Cherrypick of
145087 from /main/useplayerupdatejobs3/updatesubs_optim
- Bugfix for DummyServer not being able to spawn players/bots in unit tests
Tests: ran occlusion group tests, now pass
Optim: UpdateSubscriptions - parallelize network group comparison
Gives us ~15% improvement over serial. Hoping to parallelize gather - that's the biggest perf sink
Tests: ran unit tests
Bugfix(tests): fix perf tests doing nothing in warmup
Tests: ran perf tests
Update(tests): add perf tests for serial and parallel UpdateSubscriptions
Tests: ran it
Update(tests): added consistency test for BasePlayer.UpdateSubscriptions
- fixed a bug with stepping players who's timestamp is not due yet
- Refactored serial code slightly to keep the structure consistent
Tests: ran unit test
Bugfix(tests): when setting up a dummy server, ensure heighmap is also initialized
Needed to accomodate recent changes with tunnel net groups
Tests: perf test for snapshot deps now runs
Update: rewrite BasePlayer.UpdateSubscriptions into batch form
Doesn't actually do anything different, just prep for adding managed tasks to it. Need to add unit tests and perf tests first
Tests: booted into Craggy with jobs 3 - was able to see entities in the world
Bugfix: PartialCompare - don't miss last object in b listhashset
Could lead to a duplicate pushed to removed list
Tests: ran unit tests