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

Function build_msgpack_benchmark_case

benchmarks/python/fory_benchmark.py:393–407  ·  view source on GitHub ↗
(operation: str, obj)

Source from the content-addressed store, hash-verified

391
392
393def build_msgpack_benchmark_case(operation: str, obj):
394 if operation == "serialize":
395 if is_dataclass(obj):
396 return msgpack_serialize_dataclass, (obj,)
397 return msgpack_serialize, (obj,)
398 if operation == "deserialize":
399 if is_dataclass(obj):
400 return msgpack_deserialize_dataclass, (
401 msgpack.dumps(make_msgpack_compatible(obj), use_bin_type=True),
402 obj,
403 )
404 return msgpack_deserialize, (msgpack.dumps(obj, use_bin_type=True),)
405 if is_dataclass(obj):
406 return msgpack_roundtrip_dataclass, (obj,)
407 return msgpack_roundtrip, (obj,)
408
409
410def benchmark_args():

Callers 1

micro_benchmarkFunction · 0.85

Calls 2

make_msgpack_compatibleFunction · 0.85
dumpsMethod · 0.45

Tested by

no test coverage detected