Skip to content

[codex] Optimize capped elevation LOD lookup#2959

Merged
jasonbeverage merged 1 commit into
masterfrom
codex/elevationpool-lod-cutoff
May 4, 2026
Merged

[codex] Optimize capped elevation LOD lookup#2959
jasonbeverage merged 1 commit into
masterfrom
codex/elevationpool-lod-cutoff

Conversation

@jasonbeverage
Copy link
Copy Markdown
Member

Summary

This optimizes ElevationPool::getLOD for callers that immediately cap the returned LOD by requested sampling resolution. The helper now accepts the maximum useful LOD and stops searching a layer's data-extent R-tree as soon as it finds a level that meets or exceeds that cap.

This preserves the returned sampled LOD after the existing std::min(...) cap, while avoiding unnecessary R-tree callbacks in data-extents-heavy elevation layers.

Benchmarks

Added BM_ElevationPoolSampleMapCoordsFixedResolution, which samples 4096 map-coordinate points against a constant elevation layer with 256 overlapping data extents and validates that every point is sampled successfully.

Command, from tests after osgearth_shell.bat:

osgearth_benchmarks --benchmark_filter=BM_ElevationPoolSampleMapCoordsFixedResolution --benchmark_min_time=1s --benchmark_repetitions=3 --benchmark_report_aggregates_only=true

Before:

BM_ElevationPoolSampleMapCoordsFixedResolution/4096_mean  2897964 ns  2823795 ns

After:

BM_ElevationPoolSampleMapCoordsFixedResolution/4096_mean   218933 ns   219739 ns

That is roughly 13x faster on this targeted path.

Validation

  • configure.bat
  • build.bat
  • Focused benchmark above
  • ctest --test-dir build -C RelWithDebInfo --output-on-failure reports no registered tests
  • Documented osgearth_tests command could not run because no osgearth_tests executable was produced or installed in this build tree

@jasonbeverage jasonbeverage marked this pull request as ready for review May 4, 2026 15:32
@jasonbeverage jasonbeverage merged commit 0dd6575 into master May 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant