Skip to content

perf(web): migrate WebGL timeline rendering to IdBitset and optimize selection resolution - #925

Merged
kyasbal merged 8 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-lrvzyzlrpuzz
Aug 31, 2026
Merged

kyasbal merged 8 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-lrvzyzlrpuzz

Conversation

@kyasbal

@kyasbal kyasbal commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

Significantly accelerates timeline rendering and user interaction by replacing array-based log filtering with compact IdBitset representations, offloading dynamic status updates to WebGL shaders, and optimizing timeline/log selection resolution.

Key Changes

  • IdBitset Migration:
    • Migrates timeline filter pipeline and log visibility tracking from full object arrays to IdBitset.
    • Replaces filteredLogs with allLogs and filteredLogIds.
  • GPU-Accelerated Dynamic Status:
    • Migrates dynamic highlight/hover/selection status rendering to WebGL R32UI bitset textures and Uniform Buffer Objects (UBO).
    • Eliminates CPU-bound vertex buffer re-allocations during selection/highlight changes.
  • GLSL Shader Testing (glsl-function-tester.ts):
    • Introduces GLSLFunctionTester to unit test WebGL GLSL vertex shader functions directly in Karma/Jasmine tests.
    • Adds hit-test unit tests for shared WebGL resources.
  • Timeline Store & Selection Performance:
    • Adds reverse index (logIdToTimelineIds) in TimelineStore for $O(1)$ log-to-timeline lookups.
    • Optimizes SelectionManager to resolve selection states using bitset queries.
    • Reduces redundant computations in LogListComponent and timeline selection consumers.

Verification

  • npm test -- --watch=false --browsers=ChromeHeadless (1,049 tests passed)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request optimizes performance and reduces memory overhead in the KHI frontend by refactoring the log and timeline filtering mechanism to use bitsets (IdBitset) instead of instantiating and passing arrays of Log objects. It updates the WebGL renderers (TimelineEventsRenderer, TimelineRevisionsRenderer) to upload these bitsets as textures, allowing shaders to dynamically evaluate filter and selection states. Additionally, it introduces a GLSLFunctionTester utility to test shader functions via transform feedback. The review feedback suggests further performance optimizations by utilizing the direct logId property on Revision and Event to prevent unnecessary Log adapter instantiations in LogListComponent and StructYamlPrefetchService, and requests correcting relative imports to absolute paths in test and storybook files to align with the project's style guide.

Comment thread web/src/assets/event.vertex.glsl Resolved
Comment thread web/src/assets/shared.glsl Resolved
Comment thread web/src/assets/shared.glsl Resolved
@kyasbal kyasbal added the area:frontend Web frontend application and UI components label Aug 31, 2026
@kyasbal
kyasbal merged commit dbb6a5b into GoogleCloudPlatform:main Aug 31, 2026
16 checks passed
@kyasbal
kyasbal deleted the push-lrvzyzlrpuzz branch August 31, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Web frontend application and UI components

1 participant