1 Hour Ago
Adds lots of instrumentation, and increase navmesh build speed by around 30%, implemented common optimizations I've seen before or discussed with Lorenz: - when rasterizing triangles, reuse values between neighbors instead of re-clipping the triangle against every column (7%) - heightfield is supposed to have faster insertion than compact heightfield thanks to linked list, but because it wastes so much time pointer chasing during iteration it's actually slower, also instertion is not that bad when the column fits in cache (4%) - fuse some span filtering operation to iterate once instead of 3 times on the spans (only 1% for rust maps sadly...) + the pooling from sbox doesn't really benefit us As well as some new findings found from profiling: - during heigthfield stage when comparing span A to span B for walkability tests, don't do everything from scratch when comparing B to A (9% whole map, but monuments and bases specifically x4 speed with this) - watershed iterates through the whole list of regions multiple times, faster with lookup (7%) Can get another 10% if we halve the detail mesh precision, automatically sampled lots of tiles for vertical differences to test and the difference is negligible The real bigger order of magnitude gain is to not limit the number of threads and not time slice geometry collection, it stalls the server but goes 6x faster, could do it at server boot and just throttle the subsequent dynamic navmesh updates (player building bases, nodes etc).