()
| 1023 | } |
| 1024 | |
| 1025 | function 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 | |
| 1062 | main(); |
no test coverage detected