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

Function plot_throughput_grid_subplot

benchmarks/csharp/benchmark_report.py:256–303  ·  view source on GitHub ↗
(ax, throughputs, datatype)

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

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