MCPcopy Create free account
hub / github.com/Emmimal/control-layer / chart_4_latency

Function chart_4_latency

demo.py:505–523  ·  view source on GitHub ↗
(naive_latencies, cl_latencies, ax)

Source from the content-addressed store, hash-verified

503
504
505def chart_4_latency(naive_latencies, cl_latencies, ax):
506 naive_arr = np.array(naive_latencies)
507 cl_arr = np.array(cl_latencies)
508 categories = ["Min", "Median", "Mean", "P90", "Max"]
509 naive_vals = [naive_arr.min(), np.median(naive_arr), naive_arr.mean(),
510 np.percentile(naive_arr, 90), naive_arr.max()]
511 cl_vals = [cl_arr.min(), np.median(cl_arr), cl_arr.mean(),
512 np.percentile(cl_arr, 90), cl_arr.max()]
513 x = np.arange(len(categories))
514 width = 0.35
515 ax.bar(x - width / 2, naive_vals, width, label="Naive",
516 color=CHART_COLOR_FAIL, edgecolor="white", linewidth=1.2)
517 ax.bar(x + width / 2, cl_vals, width, label="Control Layer",
518 color=CHART_COLOR_PASS, edgecolor="white", linewidth=1.2)
519 ax.set_xticks(x)
520 ax.set_xticklabels(categories, fontsize=9)
521 _apply_base_style(ax, "Latency Breakdown: Naive vs Control Layer (ms)",
522 "Percentile", "Latency (ms)")
523 ax.legend(fontsize=8, framealpha=0.9, edgecolor=CHART_GRID)
524
525
526def chart_5_token_budget(config, ax):

Callers 1

generate_all_chartsFunction · 0.85

Calls 1

_apply_base_styleFunction · 0.85

Tested by

no test coverage detected