perf(flights): make the fleet pass's ground-floor reads cheap

Every 80 ms the Flights and Military fleet passes read the ground floor for
each coasting aircraft. With the whole globe in view that is about 10,000
aircraft, and each read built three string keys through six toFixed calls and
rewrote the terrain cache to promote its entry. At 4x CPU throttle those reads
were 5.9 s of a 15.3 s profile.

- A coast above 9,000 m (no ground reaches it) skips the geodetic conversion
  and the floor read.
- cachedGroundFloor works its cell out once, as integers; mesh cells and the
  terrain cache's synchronous reads are found by numeric key.
- A synchronous terrain-cache read promotes its entry only when it has
  drifted halfway to eviction, not on every read.

Floors are unchanged: tests compare the reads against the string-keyed ones
on cell edges, near zero and out of range.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Mazeyar Moeini FeizabadiandClaude Fable 5.2 committed 2026-11-13 15:05:38 +01:00
1 parent 188f0ccd9b
commit db7cc785df
7 files changed
+622 -15

No files matched your search

+7 -1
View File
@@ -2949,7 +2949,13 @@ visits to one place share a key but does not bound how many distinct places a
session visits, and the cache previously had no eviction, so a long session
retained every coordinate it ever resolved. Eviction is least-recently-used:
a consumer read, including a warm hit in a batch lookup, promotes its entry, so
the cell being watched is not dropped for having been resolved early. The bound sits far above a city-scale session, so
the cell being watched is not dropped for having been resolved early. A
synchronous read (`cachedEllipsoidalGround`, `cachedRealEllipsoidalGround`)
promotes its entry only once half the bound's worth of stores and promotions
have passed since the entry was last newest, so an entry read at least that
often is still never evicted while the per-frame floor reads no longer rewrite
the cache; those reads find entries through a numeric key and format no
strings. The bound sits far above a city-scale session, so
normal use never evicts and issues no additional proxy requests. A batch's
results are assembled from what that call resolved or found warm, so eviction
during a large batch cannot report one of its points as unresolved. Re:Earth and