Simplify navmesh cache
- Change nested map into a flat map with tuple key
- Remove exception for a case that never happens
- Remove redundant logic from set
- Add benchmarks to make sure there is no performance degradation
On my machine benchmark results are following:
before:
------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------
getFromFilledCache_1m_100hit 43858 ns 43781 ns 16114
getFromFilledCache_4m_100hit 44945 ns 44830 ns 15381
getFromFilledCache_16m_100hit 45681 ns 45652 ns 15309
getFromFilledCache_64m_100hit 45984 ns 45955 ns 15238
getFromFilledCache_1m_70hit 33548 ns 33530 ns 20880
getFromFilledCache_4m_70hit 34418 ns 34396 ns 20301
getFromFilledCache_16m_70hit 35470 ns 35448 ns 19735
getFromFilledCache_64m_70hit 35883 ns 35859 ns 19298
setToBoundedNonEmptyCache_1m 45902 ns 45872 ns 15225
setToBoundedNonEmptyCache_4m 47148 ns 47116 ns 14857
setToBoundedNonEmptyCache_16m 48004 ns 47970 ns 14603
setToBoundedNonEmptyCache_64m 49595 ns 49400 ns 14374
after:
------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------
getFromFilledCache_1m_100hit 39409 ns 39382 ns 17741
getFromFilledCache_4m_100hit 41093 ns 41062 ns 17071
getFromFilledCache_16m_100hit 41933 ns 41868 ns 16701
getFromFilledCache_64m_100hit 42235 ns 42151 ns 16646
getFromFilledCache_1m_70hit 30571 ns 30552 ns 22946
getFromFilledCache_4m_70hit 31811 ns 31754 ns 22012
getFromFilledCache_16m_70hit 32461 ns 32436 ns 21572
getFromFilledCache_64m_70hit 33256 ns 33228 ns 21137
setToBoundedNonEmptyCache_1m 44085 ns 44043 ns 15925
setToBoundedNonEmptyCache_4m 45177 ns 45139 ns 15465
setToBoundedNonEmptyCache_16m 46195 ns 46145 ns 15151
setToBoundedNonEmptyCache_64m 46685 ns 46607 ns 15021