[PR #1234] [MERGED] perf(client): cache weather column direction table #3442

Closed
opened 2026-11-03 04:09:34 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1234
Author: @rdbtCVS
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @ludovic111

Base: main ← Head: t3/cache-column-size-table


📝 Commits (1)

  • 0540043 perf(client): cache weather column direction table

📊 Changes

1 file changed (+35 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/weather.rs (+35 -5)

📄 Description

Weather quad generation currently recomputes a square root and two normalizing divisions for each column on every frame. Cache the fixed 32×32 direction table in a LazyLock, initialized once on first use. Keep the original f64 square root, f32 conversion and division order, including the center column's 0/0 NaNs.

Production changes are confined to column_size in weather.rs. Rain/snow parameter generation, the Column API, shaders, cached height lookups and allocation-free tiling are unchanged.

Validation:

  • cargo test --locked -p horizon-client --lib weather::tests --no-default-features -j 2: all 5 tests pass, including exhaustive bitwise comparison of all 1,024 table entries against the original arithmetic (NaN classification at the center) and all center-quad horizontal coordinates remaining NaN.
  • python3 tools/test_weather_render_parity.py: all 513 cases match the pinned 26.3 client byte-for-byte.
  • Additional local sweep through the existing Java oracle and Rust weather fixture: all 4,096 cases match, covering every table index for rain and snow at two fractional camera positions, including large translated coordinates.
  • cargo clippy --locked -p horizon-client --lib --no-default-features -j 2 -- -D warnings, cargo fmt --all -- --check and git diff --check pass.

The table stores 8 KiB of entries and performs initialization on first use. No frame-rate or timing improvement was measured; parity covers column data and quad vertices, not full framebuffer output.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1234 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `t3/cache-column-size-table` --- ### 📝 Commits (1) - [`0540043`](https://github.com/horizon-rust/horizon/commit/05400438c7f034a380815b6ed606b181bb3bdb3b) perf(client): cache weather column direction table ### 📊 Changes **1 file changed** (+35 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/weather.rs` (+35 -5) </details> ### 📄 Description Weather quad generation currently recomputes a square root and two normalizing divisions for each column on every frame. Cache the fixed 32×32 direction table in a `LazyLock`, initialized once on first use. Keep the original f64 square root, f32 conversion and division order, including the center column's 0/0 NaNs. Production changes are confined to `column_size` in `weather.rs`. Rain/snow parameter generation, the `Column` API, shaders, cached height lookups and allocation-free tiling are unchanged. Validation: - `cargo test --locked -p horizon-client --lib weather::tests --no-default-features -j 2`: all 5 tests pass, including exhaustive bitwise comparison of all 1,024 table entries against the original arithmetic (NaN classification at the center) and all center-quad horizontal coordinates remaining NaN. - `python3 tools/test_weather_render_parity.py`: all 513 cases match the pinned 26.3 client byte-for-byte. - Additional local sweep through the existing Java oracle and Rust weather fixture: all 4,096 cases match, covering every table index for rain and snow at two fractional camera positions, including large translated coordinates. - `cargo clippy --locked -p horizon-client --lib --no-default-features -j 2 -- -D warnings`, `cargo fmt --all -- --check` and `git diff --check` pass. The table stores 8 KiB of entries and performs initialization on first use. No frame-rate or timing improvement was measured; parity covers column data and quad vertices, not full framebuffer output. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:09:34 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3442
No description provided.