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

Function load_serialized_sizes

benchmarks/rust/benchmark_report.py:175–197  ·  view source on GitHub ↗
(size_file)

Source from the content-addressed store, hash-verified

173
174
175def load_serialized_sizes(size_file):
176 if not os.path.exists(size_file):
177 return {}
178
179 pattern = re.compile(
180 r"^\|\s*([^|]+?)\s*\|\s*(\d+|n/a)\s*\|\s*(\d+|n/a)\s*\|\s*(\d+|n/a)\s*\|$",
181 re.IGNORECASE,
182 )
183 sizes = {}
184 with open(size_file, "r", encoding="utf-8") as file:
185 for line in file:
186 match = pattern.match(line.strip())
187 if not match:
188 continue
189 datatype, fory_size, protobuf_size, msgpack_size = match.groups()
190 if datatype == "Datatype":
191 continue
192 sizes[datatype] = {
193 "fory": parse_size_value(fory_size),
194 "protobuf": parse_size_value(protobuf_size),
195 "msgpack": parse_size_value(msgpack_size),
196 }
197 return sizes
198
199
200def parse_size_value(value):

Callers 1

mainFunction · 0.70

Calls 3

parse_size_valueFunction · 0.85
compileMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected