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

Function main

benchmarks/javascript/benchmark.js:1025–1060  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1023}
1024
1025function main() {
1026 const options = parseArgs(process.argv.slice(2));
1027 options.schemaMismatch = schemaMismatchEnabled();
1028 validateSchemaMismatchSelection(options, options.schemaMismatch);
1029 const root = protobuf.loadSync(path.join(REPO_ROOT, "benchmarks", "proto", "bench.proto"));
1030 const datasets = createDatasets(root, options.schemaMismatch);
1031 const verificationDatasets = options.data
1032 ? datasets.filter((dataset) => dataset.key === options.data)
1033 : datasets;
1034 verificationDatasets.forEach(
1035 options.schemaMismatch ? verifySchemaMismatch : ensureSerializationWorks
1036 );
1037
1038 const structSize = serializeBytes("fory", datasets.find((item) => item.key === "struct"), createNumericStruct()).length;
1039 console.log(`Fory NumericStruct serialized size: ${structSize} bytes`);
1040
1041 const result = {
1042 context: {
1043 date: new Date().toISOString(),
1044 host_name: os.hostname(),
1045 executable: process.execPath,
1046 num_cpus: os.cpus().length,
1047 node_version: process.version,
1048 v8_version: process.versions.v8,
1049 duration_seconds: options.durationSeconds,
1050 schema_mismatch: options.schemaMismatch,
1051 },
1052 benchmarks: buildResults(datasets, options),
1053 };
1054
1055 fs.writeFileSync(options.output, JSON.stringify(result, null, 2));
1056 console.log(`Saved benchmark results to ${options.output}`);
1057 if (blackhole === Number.MIN_SAFE_INTEGER) {
1058 console.log("unreachable blackhole guard");
1059 }
1060}
1061
1062main();

Callers 1

benchmark.jsFile · 0.70

Calls 11

parseArgsFunction · 0.85
createDatasetsFunction · 0.85
serializeBytesFunction · 0.85
createNumericStructFunction · 0.85
buildResultsFunction · 0.85
findMethod · 0.80
logMethod · 0.80
schemaMismatchEnabledFunction · 0.70
sliceMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected