From 7174291dfc9c5a10e43f0f2461bcf2ca014d628e Mon Sep 17 00:00:00 2001 From: Omkar Gaikwad Date: Sun, 9 Aug 2026 14:45:31 +0000 Subject: [PATCH] perf(viewer): send only plotted columns to the D3 charts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit generate_d3_chart serialized every column of the trends cache into each sandboxed iframe, including ai_summary — a ~1.7 KB LLM paragraph per run that no chart reads. Four charts on 300 runs shipped 2.56 MB of HTML. Project to the columns the chart actually uses: 131 KB, ~19x smaller. job_id is kept because chart.js reads it for the hover tooltip. --- viewer/trends.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/viewer/trends.py b/viewer/trends.py index 1f1c7436..a8c41706 100644 --- a/viewer/trends.py +++ b/viewer/trends.py @@ -24,8 +24,9 @@ def get_results_dir(): return results_dir_candidates[1] # Fallback to default def generate_d3_chart(df, x_col, y_col, hue_col, title, ylabel): - df_sorted = df.sort_values(by=x_col) - + # job_id is unplotted but read by the tooltip in chart.js. + df_sorted = df[[x_col, y_col, hue_col, "job_id"]].sort_values(by=x_col) + # Convert dataframe to records for JSON data_records = df_sorted.to_dict(orient='records') import json