Skip to content

Make canonical DisplayedEvents primary and drop per-table materialization#510

Merged
jschick04 merged 1 commit intomainfrom
jschick/refactor_combinedview
May 4, 2026
Merged

Make canonical DisplayedEvents primary and drop per-table materialization#510
jschick04 merged 1 commit intomainfrom
jschick/refactor_combinedview

Conversation

@jschick04
Copy link
Copy Markdown
Collaborator

Problem

The "Combined" view is the user's primary view when ≥2 logs are open, but the architecture inverts this: it materializes a DisplayedEvents list per log (treated as primary), then maintains an additional materialized list for Combined that is rebuilt from scratch on every event-flow tick via ReduceUpdateCombinedEvents (a full k-way merge plus an O(N) SequenceEqual sanity check). The merge work is paid even when nothing changed, dispatched after every AppendTableEvents, AppendTableEventsBatch, UpdateDisplayedEvents, and UpdateTable.

Approach

Make Combined the single canonical materialized view, maintained incrementally. Drop per-log DisplayedEvents materialization. Per-log tabs derive their view by OwningLog filter on demand when activated.

  • EventTableState gains a canonical IReadOnlyList<DisplayEventModel> DisplayedEvents.
  • EventTableModel becomes metadata-only (no per-log DisplayedEvents).
  • EventTableReducers maintains the canonical list incrementally on append / batch / filter / sort / close paths.
  • ReduceUpdateCombinedEvents (and its action) deleted entirely along with the four effects that dispatched it.
  • EventTable.razor.cs reads from state.DisplayedEvents, applying a per-log filter only when a per-log tab is active (with a 1-entry cache keyed by table id + canonical reference).
  • StatusBar and SplitLogTabPane updated to read counts and ComputerName from the canonical list.

Performance (benchmarks captured pre/post; project not landed in this PR)

Host: AMD EPYC 7763 2.44GHz (Hyper-V VM), .NET 10.0.7, BenchmarkDotNet v0.15.4, RunStrategy=Throughput.

Scenario K N/log Baseline Refactor Δ Mean Baseline Alloc Refactor Alloc Δ Alloc
AppendTableEvents (live-tail) 2 100k 11.60 ms 0.94 ms −92% 2.29 MB 1.53 MB −33%
AppendTableEvents (live-tail) 5 100k 34.21 ms 2.22 ms −94% 4.58 MB 3.82 MB −17%
AppendTableEventsBatch 2 100k 11.98 ms 0.95 ms −92% 3.05 MB 1.53 MB −50%
AppendTableEventsBatch 5 100k 37.00 ms 2.21 ms −94% 7.63 MB 3.82 MB −50%
UpdateDisplayedEvents (filter) 5 100k 71.46 ms 55.76 ms −22% 7.63 MB 7.63 MB 0%
Sequential UpdateTable per log (load) 5 100k 107.20 ms 64.74 ms −40% 15.27 MB 14.5 MB −5%
CloseLog 5 100k 25.11 ms 13.08 ms −48% 3.05 MB 3.82 MB +25%

The hot live-tail path (every event tick) is 92–94% faster and uses ~17–50% less memory — that's what dominates real-world usage. Cold paths (filter change, load completion, close log) are 22–48% faster with neutral or slight allocation deltas.

Verification

  • 880 UI unit tests pass (rewrites of EventTableStoreTests for the new shape; EventTableEffectsTests shrunk by 26 lines as the deleted action removed test surface).
  • MAUI app builds clean (0 warnings, 0 errors).
  • Multiple rubber-duck and code-review passes (Claude Opus + GPT-5) during development.
  • Strict comment-hygiene audit applied across every touched file.

Copilot AI review requested due to automatic review settings May 3, 2026 03:34
@jschick04 jschick04 requested a review from a team as a code owner May 3, 2026 03:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the event-table store so the combined view becomes the single canonical materialized list, with per-log tabs derived from that canonical data instead of maintaining separate per-table DisplayedEvents collections. In the broader codebase, this moves work out of the old repeated combined-view rebuild path and centralizes filtering/sorting/count state in EventTableState.

Changes:

  • Add canonical DisplayedEvents and per-log visible-count tracking to EventTableState, and remove per-table materialized event lists from EventTableModel.
  • Rewrite EventTableReducers to maintain the canonical list incrementally on append, batch append, full table update, filter update, sort, and close paths.
  • Update UI components and tests to read from the canonical state shape, and delete the obsolete UpdateCombinedEvents action/effects.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/EventLogExpert/Components/StatusBar.razor Switches visible/hidden event counts to the canonical table state and per-log count map.
src/EventLogExpert/Components/SplitLogTabPane.razor.cs Updates tab naming/empty-state logic to use stored metadata and per-log visible counts.
src/EventLogExpert/Components/EventTable.razor.cs Derives the active table view from canonical events, adds per-log filtering/cache, and adjusts rescroll behavior.
src/EventLogExpert/Components/EventTable.razor Binds the rendered grid and ARIA row count to the derived active event list.
src/EventLogExpert.UI/Store/EventTable/EventTableState.cs Introduces canonical displayed events and EventCountByLog into Fluxor state.
src/EventLogExpert.UI/Store/EventTable/EventTableReducers.cs Reworks reducers around canonical event storage and removes combined-view recomputation.
src/EventLogExpert.UI/Store/EventTable/EventTableEffects.cs Removes now-unneeded effects that used to trigger combined-view updates.
src/EventLogExpert.UI/Store/EventTable/EventTableAction.cs Deletes the obsolete UpdateCombinedEvents action.
src/EventLogExpert.UI/Models/EventTableModel.cs Converts table models to metadata-only records with stored ComputerName.
src/EventLogExpert.UI.Tests/Store/EventTable/EventTableStoreTests.cs Rewrites reducer tests for the canonical-state design and new metadata behavior.
src/EventLogExpert.UI.Tests/Store/EventTable/EventTableEffectsTests.cs Removes tests for the deleted combined-update effect path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/EventLogExpert/Components/EventTable.razor.cs Outdated
Comment thread src/EventLogExpert.UI/Store/EventTable/EventTableReducers.cs
Comment thread src/EventLogExpert.UI/Store/EventTable/EventTableReducers.cs
Comment thread src/EventLogExpert.UI.Tests/Store/EventTable/EventTableStoreTests.cs Outdated
@jschick04 jschick04 force-pushed the jschick/refactor_combinedview branch from 50e5c32 to 03c0eaf Compare May 3, 2026 04:49
@jschick04 jschick04 requested a review from Copilot May 3, 2026 04:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jschick04 jschick04 merged commit ed578b0 into main May 4, 2026
10 checks passed
@jschick04 jschick04 deleted the jschick/refactor_combinedview branch May 4, 2026 15:48
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.

3 participants