time-to-botec/squiggle/node_modules/@quri/squiggle-lang/scripts/bench-map-reduce.ts

19 lines
452 B
TypeScript
Raw Normal View History

#!/usr/bin/env node
import { SqProject } from "../src/js";
import { measure } from "../src/js/cli/utils";
const maxP = 5;
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| List.upTo(1, 100) |> reduce(0, {|a,b|a+b})})`
);
const time = measure(() => {
project.run("main");
});
console.log(`1e${p}`, "\t", time);
}