squiggle/packages/squiggle-lang/scripts/bench-sampleset-to-pointset.mjs
2022-09-20 00:57:20 +04:00

23 lines
498 B
JavaScript
Executable File

#!/usr/bin/env node
import { SqProject } from "@quri/squiggle-lang";
import { measure } from "./lib.mjs";
const maxP = 7;
for (let p = 0; p <= maxP; p++) {
const size = Math.pow(10, p);
const project = SqProject.create();
project.setSource(
"main",
`
List.upTo(1, ${size}) -> map({|x|
normal(x,2) -> SampleSet.fromDist -> PointSet.fromDist
})->List.last
`
);
const time = measure(() => {
project.run("main");
});
console.log(`1e${p}`, "\t", time);
}