Skip to content

perf: downsample overview pnl chart points#7

Open
christianarriaga1234-coder wants to merge 1 commit into
Dragoon4002:mainfrom
christianarriaga1234-coder:perf/downsample-pnl-chart
Open

perf: downsample overview pnl chart points#7
christianarriaga1234-coder wants to merge 1 commit into
Dragoon4002:mainfrom
christianarriaga1234-coder:perf/downsample-pnl-chart

Conversation

@christianarriaga1234-coder

Copy link
Copy Markdown

Summary

Refs #2.

This PR reduces the render load of the Overview PnL chart when accounts accumulate large trade histories. It keeps the cumulative PnL series accurate, then applies Largest-Triangle-Three-Buckets downsampling before handing data to Recharts so the chart renders a bounded number of representative points.

Type

  • Performance improvement

Changes

  • Added a 600-point render cap for the Overview PnL chart.
  • Added LTTB downsampling to preserve the first point, final cumulative PnL, and representative shape/extremes.
  • Kept the existing chart API and no-data behavior unchanged.

Performance validation

  • Synthetic 50,000-point PnL series downsampled to 600 rendered points.
  • Point reduction: ~83.3x fewer chart points for Recharts to lay out/render.
  • Local micro-benchmark for the downsampling pass: 8.459ms on 50,000 points via Node 26 bundled runtime.

Testing

  • Ran a local Node micro-benchmark of the downsampling helper logic.
  • Verified the first and final cumulative PnL values are preserved in the sampled output.
  • Could not run Next lint/build locally because this clone does not include node_modules and dependencies were not installed.

Checklist

  • No secrets, API keys, or private keys committed
  • No backend schema changes
  • Single focused UI performance change

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@christianarriaga1234-coder is attempting to deploy a commit to the dragoon4002's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant