perf(ui/interfaces): reduce per-row rate lookups#455
Open
snvtac wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Interfaces tab rebuilds one table row per network interface on each render. That row construction previously queried the rate map twice with the same
interface_name: once for RX and once for TX.This reuses one
rates.get(&stat.interface_name)result for both rate columns, and borrows the interface name when building the first cell instead of cloning theString. The table contents, sorting, scroll windowing, and scrollbar behavior are unchanged.Linked issue
References #398.
Verification
Per CONTRIBUTING.md > Code Quality Requirements,
I ran the following locally and they all pass:
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo test --all-featurescargo build --releaseAdditional checks:
cargo test -p rustnet-monitor ui::snapshot_tests::interfaces_tabcargo deny check(advisories,bans,licenses, andsourcesok; existing duplicate-crate warnings only)Scope
#[allow(clippy::...)]suppressions, or rationale provided(see CONTRIBUTING.md)
AI-assisted contributions
If you used an AI assistant (Copilot, Claude, ChatGPT, Cursor, etc.) to
write any of this code, that is fine, but please confirm:
Notes for the reviewer
No user-visible output change is intended; the existing Interfaces tab snapshot covers the rendered table after this change.