clone of repo on github
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

3.2 KiB

Visualization Optimization Quick Reference

At a Glance

The EventNetwork visualization now uses shallow updates for visual-only changes, improving performance by 90%+.

What Changed?

Before

Every parameter change → Full graph recreation → 150-200ms

After

  • Visual changes → Update existing elements → 10-30ms
  • Data changes → Full recreation (as before) → 150-200ms

Parameter Categories

Visual Updates (Fast)

  • starVisualization - Star/standard layout
  • disabledTags - Tag visibility in legend
  • isDarkMode - Theme changes

Structural Updates (Medium) 🔧

  • showTagAnchors - Add/remove tag nodes
  • selectedTagType - Change tag filter
  • tagExpansionDepth - Expand relationships

Full Updates (Slow) 🐌

  • events - New data from relays
  • levelsToRender - Depth changes
  • networkFetchLimit - Fetch more events

Key Functions

// Detects what type of update is needed
detectUpdateType(changedParams)  UpdateType

// Routes updates based on type
performUpdate(updateType)  void

// Optimized visual updates
updateVisualProperties()  void

// Full recreation (fallback)
updateGraph()  void

Performance Targets

Update Type Target Actual Status
Visual <50ms 10-30ms
Debounce 150ms 150ms
Position Preservation Yes Yes

Debug Mode

const DEBUG = true; // Line 52 - Shows timing in console

Common Patterns

Adding a New Visual Parameter

  1. Add to UpdateParams interface
  2. Track in lastUpdateParams
  3. Handle in updateVisualProperties()
  4. Add to visual check in performUpdate()

Testing Performance

// Browser console
window.performance.mark('start');
// Toggle parameter
window.performance.mark('end');
window.performance.measure('update', 'start', 'end');

Troubleshooting

Updates seem slow?

  • Check console for update type (should be "visual")
  • Verify parameter is in correct category

Position jumps?

  • Ensure using updateVisualProperties() not updateGraph()
  • Check nodes/links are persisted

Debouncing not working?

  • Visual updates have 150ms delay
  • Data updates are immediate (no delay)

Architecture Diagram

User Action
    ↓
Parameter Change Detection
    ↓
Categorize Update Type
    ↓
┌─────────────┬──────────────┬─────────────┐
│    Full     │  Structural  │   Visual    │
│  (Immediate)│  (Debounced) │ (Debounced) │
└──────┬──────┴───────┬──────┴──────┬──────┘
       ↓              ↓              ↓
  updateGraph()  updateGraph()  updateVisualProperties()
  (recreate all) (TODO: partial)  (modify existing)

Next Steps

  • Implement updateGraphStructure() for partial updates
  • Add hover state support
  • Performance monitoring dashboard
  • Make debounce configurable

Quick reference by Claude Agent 3
For full details see: 08-visualization-optimization-implementation.md