Skip to content

perf: Optimize data preview loading with sparse sampling #201

@cptkoolbeenz

Description

@cptkoolbeenz

Summary

Loading data previews for large logged sessions currently takes several minutes and consumes significant PC resources because all data points are loaded and rendered. Implement sparse sampling to dramatically improve preview performance.

Current Behavior

  • Large logs (millions of samples) take many minutes to load preview
  • High CPU and memory usage during preview generation
  • UI becomes unresponsive during loading
  • All data points are loaded into memory and rendered

Proposed Solution

  1. Read the total number of samples in the logged session
  2. Calculate an appropriate sparse sampling rate based on:
    • Total sample count
    • Display resolution/viewport size
    • Target number of points for smooth visualization (e.g., 10,000 points max)
  3. Load only the sparse subset of points needed for preview
  4. Render the preview with the reduced dataset

Example

  • Session with 50 million samples
  • Target: 10,000 preview points
  • Sample every 5,000th point for preview
  • Load time reduced from minutes to seconds

Benefits

  • Preview loads in seconds instead of minutes
  • Reduced memory usage
  • UI remains responsive
  • Still provides accurate visualization of data trends

Technical Considerations

  • Ensure sampling maintains data characteristics (peaks, valleys)
  • Consider using min/max decimation for better signal preservation
  • Full data still available for export and detailed analysis

Acceptance Criteria

  • Preview loads in <5 seconds for sessions with millions of samples
  • Memory usage stays reasonable (<500MB for preview)
  • Preview accurately represents data trends
  • UI remains responsive during loading
  • Full resolution data still accessible for export

Related Issues

Labels

enhancement, performance, ui

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions