Skip to content

cabana: optimize sparkline rendering by reducing points in horizontal segments #35689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2025

Conversation

deanlee
Copy link
Contributor

@deanlee deanlee commented Jul 11, 2025

This PR improves sparkline performance by removing redundant points in horizontal segments (i.e. where Y values remain constant), while preserving visual accuracy.

For example, rendering a 100 Hz constant signal over 30s previously drew ~3000 lines; with this PR, it's reduced to just one.

Benefits

  • Reduces point count by 50–90% for signals with flat segments (common in CAN data)
  • Improves rendering speed by reducing drawPolyline overhead
  • Enables antialiasing more often (under 500-point threshold)
  • Cuts Cabana CPU usage by ~10%

@github-actions github-actions bot added the tools label Jul 11, 2025
@deanlee deanlee marked this pull request as draft July 12, 2025 02:46
@deanlee deanlee force-pushed the cabana_improve_sparkline branch 2 times, most recently from 2f50554 to 5b1cd3a Compare July 12, 2025 06:23
@deanlee deanlee force-pushed the cabana_improve_sparkline branch from 5b1cd3a to 743d2a3 Compare July 12, 2025 09:15
@deanlee deanlee marked this pull request as ready for review July 12, 2025 22:47
@adeebshihadeh adeebshihadeh merged commit 12f766f into commaai:master Jul 13, 2025
17 checks passed
@deanlee deanlee deleted the cabana_improve_sparkline branch July 13, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants