MCPcopy Create free account
hub / github.com/apache/fory / plot_throughput_grid_subplot

Function plot_throughput_grid_subplot

benchmarks/cpp/benchmark_report.py:255–301  ·  view source on GitHub ↗
(ax, datatype)

Source from the content-addressed store, hash-verified

253
254# === Create combined TPS comparison plot ===
255def plot_throughput_grid_subplot(ax, datatype):
256 if datatype not in data:
257 ax.set_title(f"{format_datatype_table_label(datatype)}\nNo Data")
258 ax.axis("off")
259 return
260
261 available_libs = [
262 lib
263 for lib in SERIALIZER_ORDER
264 if any(
265 data[datatype][operation].get(lib, 0) > 0
266 for operation in ["serialize", "deserialize"]
267 )
268 ]
269 if not available_libs:
270 ax.set_title(f"{format_datatype_table_label(datatype)}\nNo Data")
271 ax.axis("off")
272 return
273
274 operations = ["serialize", "deserialize"]
275 x = GROUP_X
276 for idx, lib in enumerate(available_libs):
277 times = [data[datatype][operation].get(lib, 0) for operation in operations]
278 tps = [1e9 / t if t > 0 else 0 for t in times]
279 offset = serializer_offset(idx, len(available_libs))
280 ax.bar(
281 x + offset,
282 tps,
283 GROUP_BAR_WIDTH,
284 label=SERIALIZER_LABELS.get(lib, lib),
285 color=COLORS.get(lib, "#888888"),
286 edgecolor=BAR_EDGE_COLOR,
287 linewidth=0.8,
288 )
289
290 max_tps = max(
291 1e9 / data[datatype][operation][lib]
292 for operation in operations
293 for lib in available_libs
294 if data[datatype][operation].get(lib, 0) > 0
295 )
296 ax.set_ylim(0, max_tps * 1.12)
297 ax.set_title(format_datatype_table_label(datatype), pad=8)
298 set_grouped_operation_axis(ax)
299 style_throughput_axis(ax)
300 ax.yaxis.set_major_formatter(FuncFormatter(format_tps_tick))
301 add_compact_legend(ax)
302
303
304fig, axes = plt.subplots(2, 3, figsize=(16.5, 9.0))

Callers 1

Calls 7

serializer_offsetFunction · 0.90
style_throughput_axisFunction · 0.90
add_compact_legendFunction · 0.90
anyFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected