time-to-botec/squiggle/node_modules/@quri/squiggle-lang/dist/scripts/bench-sampleset-to-pointset.js

31 lines
1012 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const js_1 = require("../src/js");
const utils_1 = require("../src/js/cli/utils");
const maxP = 3;
const sampleCount = process.env.SAMPLE_COUNT;
for (let p = 0; p <= maxP; p++) {
const size = Math.pow(10, p);
const project = js_1.SqProject.create();
if (sampleCount) {
project.setEnvironment({
sampleCount: Number(sampleCount),
xyPointLength: Number(sampleCount),
});
}
project.setSource("main", `
List.upTo(1, ${size}) -> map(
{ |x| normal(x,2) -> SampleSet.fromDist -> PointSet.fromDist }
)->List.last
`);
const time = (0, utils_1.measure)(() => {
project.run("main");
});
const result = project.getResult("main");
if (result.tag != "Ok") {
throw new Error("Code failed: " + result.value.toString());
}
console.log(`1e${p}`, "\t", time);
}
//# sourceMappingURL=bench-sampleset-to-pointset.js.map