Files
ziran/scripts/site_target_node.cjs
T
waozi 4dc2da6b09 Publish measured desktop, Android and web target matrix
Compare five real examples across four targets on three measured platforms, preserving raw samples, independent output verification and artifact provenance.

Complete the WebAssembly support needed by the examples, inspect ZX bundles, prune generated C dependencies while preserving C++ linkage, and validate native script execution. Optimize only the temporary bootstrap seed and retain fresh-build measurements and historical benchmark records under bench/results.

Local tests: all 522 cases passed across the full run and corrected header-test rerun; all 16 bootstrap modules match. Playground runtime, bundle runtime, private browser layouts and matrix controls, published artifacts and local site links passed.
2026-11-10 23:50:12 -03:00

16 lines
863 B
JavaScript

const fs = require('node:fs');
const measure = require('../site/target-measure.js');
(async () => {
const [file, expected, samples] = process.argv.slice(2);
const started = performance.now();
let recording = true;
const abi = require('../site/target-abi.js')(bytes => { if (recording) process.stdout.write(bytes); });
const {instance} = await WebAssembly.instantiate(fs.readFileSync(file), abi.imports);
abi.attach(instance);
const loaded = performance.now() - started;
if (instance.exports.zx_entry().toString() !== expected) throw Error('First result differs from oracle');
recording = false;
const result = measure(() => { abi.resetBudget(); return instance.exports.zx_entry(); }, expected, Number(samples));
console.log(JSON.stringify({...result, load_ms: loaded}));
})().catch(error => { console.error(error); process.exitCode = 1; });