You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: cached header/status-bar info, 500ms API timeout, zero per-frame format!()
- Cache HeaderInfo struct (cluster name, endpoint, k8s ver, config path)
via sync_header_info() — eliminates O(n) clusters.iter().find() per frame
- Pre-compute status_bar_self_line on fetch arrival — eliminates per-frame
format!() for RSS/latency display
- Pre-compute NodeInfo.top_display during fetch — eliminates per-node
format!() per frame in Top tab
- Cache ctx_title_span on cluster/namespace change — eliminates per-frame
format!("| {} ", ctx_label) in center panel title
- Static render_usage_bar label spans — eliminates 2 format!() per bar
- Reduce API_CALL_TIMEOUT from 1s to 500ms — halves worst-case fetch latency
- Fix headless run_headless() to use join_all instead of sequential await
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ scalex dash --headless --resource pods # Filter by resource type (pods, nodes,
107
107
-**Node VERSION column**: `NodeInfo.kubelet_version` populated from `node.status.nodeInfo.kubeletVersion`. Shown in nodes table after ROLES column and in Top tab after node name. Useful for upgrade planning.
108
108
-**Service EXTERNAL-IP column**: `ServiceInfo.external_ip` populated from `status.loadBalancer.ingress[].ip/hostname`. Shows `<none>` for non-LB services. Column appears between CLUSTER-IP and PORTS.
109
109
-**Alphabetical resource sorting**: Deployments, services, configmaps, and nodes sorted by name after fetch. Pods retain severity-first sorting (CrashLoopBackOff first, then pending, running, completed).
110
-
-**Reduced API timeouts**: `API_CALL_TIMEOUT` reduced from 2s to 1s, `DISCOVER_TIMEOUT` from 3s to 2s. Healthy clusters respond in <200ms; tighter timeouts halve worst-case fetch latency.
110
+
-**Reduced API timeouts**: `API_CALL_TIMEOUT` reduced from 2s to 500ms, `DISCOVER_TIMEOUT` from 3s to 2s. Healthy clusters respond in <200ms; tighter timeouts minimize worst-case fetch latency.
111
111
-**Zero-clone tree index lookups**: `tree_index_at_cursor()` reads from cached visible indices without cloning `Vec<usize>`. `ensure_visible_indices_cached()` populates cache; callers avoid `visible_tree_indices_cached()` clone where possible.
112
112
-**Static sidebar padding**: `render_sidebar` uses static `SPACES` buffer for row padding instead of per-row `" ".repeat(pad)` heap allocation.
113
113
-**Cached row count**: `cached_row_count: Option<usize>` avoids redundant O(n) filter iterations in `move_down`/`page_down`/`jump_end`/`render_center`. Invalidated per event cycle.
@@ -183,6 +183,12 @@ The TUI header is k9s-style and responsive:
183
183
-**CF Tunnel SA token auth**: CF Tunnel cannot proxy mTLS client certs, so `build_client_with_endpoint()` strips kubeconfig CA + client cert and injects a ServiceAccount bearer token. SA `scalex-dash` in `scalex-system` namespace, bound to `view` ClusterRole. Token cached at `_generated/clusters/{name}/dash-token`. Auto-provisioned on first run via SSH through bastion if cached token absent. Module: `sa_provisioner.rs`. To re-provision: delete `dash-token` and relaunch.
184
184
-**k9s attribution**: help overlay (`?` key) footer shows "Inspired by k9s (github.com/derailed/k9s)" in DarkGray.
185
185
-**Cached data persistence**: `render_tab_preamble` returns cached snapshot even when `ConnectionStatus::Failed` — error shown as 1-line red banner via `render_connection_error_banner()`, not full-area replacement. Data stability: once displayed, data stays visible until next fetch result arrives.
186
+
-**Cached header info**: `HeaderInfo` struct (cluster_name, endpoint, k8s_version, config_path) pre-computed via `sync_header_info()` on cluster selection change and discovery events. `render_header` reads cached struct instead of O(n) `clusters.iter().find()` + `display().to_string()` per frame.
187
+
-**Pre-computed status bar self/latency**: `status_bar_self_line` caches `"| self: 42MB | latency: 150ms"` on fetch result arrival. Spinner appended dynamically only when fetching. Eliminates per-frame `format!()` for rss + latency.
188
+
-**Pre-computed top tab node display**: `NodeInfo.top_display` pre-computed during fetch as `" v1.33.1 CPU: 8/8 MEM: 7.5Gi/7.8Gi"`. `render_top_tab` borrows pre-computed string instead of per-node `format!()` per frame.
189
+
-**Cached center panel title**: `ctx_title_span` pre-computed on cluster/namespace change via `sync_ctx_label()`. `render_center` borrows cached string instead of per-frame `format!("| {} ", ctx_label)`.
190
+
-**Static usage bar labels**: `render_usage_bar` uses static `label` + `" ["` spans instead of `format!("{} [", label)`. Eliminates 2 format allocations per bar per frame.
191
+
-**Headless parallel fetch**: `run_headless` uses `futures::future::join_all` instead of sequential `for handle in handles { handle.await }` for cluster data fetching.
186
192
-**Per-resource fetch tracking**: `fetched_resources: HashSet<ActiveResource>` distinguishes "not yet fetched" (empty vec, not in set) from "fetched but truly empty" (empty vec, in set). Cleared on cluster/namespace change. View switch to unfetched resource shows "Loading {type}..." spinner instead of empty table.
0 commit comments