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

Function serializeBytes

benchmarks/javascript/benchmark.js:889–900  ·  view source on GitHub ↗
(serializerName, dataset, value)

Source from the content-addressed store, hash-verified

887}
888
889function serializeBytes(serializerName, dataset, value) {
890 switch (serializerName) {
891 case "fory":
892 return dataset.foryWriter.serialize(normalizeForyValue(dataset.key, value));
893 case "protobuf":
894 return dataset.protoType.encode(dataset.toProto(value)).finish();
895 case "json":
896 return Buffer.from(JSON.stringify(value), "utf8");
897 default:
898 throw new Error(`Unknown serializer ${serializerName}`);
899 }
900}
901
902function createBenchmarkCase(serializerName, dataset, operation) {
903 const value = dataset.createValue();

Callers 2

buildResultsFunction · 0.85
mainFunction · 0.85

Calls 6

normalizeForyValueFunction · 0.85
toProtoMethod · 0.80
serializeMethod · 0.65
encodeMethod · 0.65
finishMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected