time-to-botec/squiggle/node_modules/@quri/squiggle-lang/scripts/bench-map.ts
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

19 lines
498 B
JavaScript
Executable File

#!/usr/bin/env node
import { SqProject } from "../src/js";
import { measure } from "../src/js/cli/utils";
const maxP = 7;
for (let p = 0; p <= maxP; p++) {
const size = Math.pow(10, p);
const project = SqProject.create();
project.setSource("list", `l = List.upTo(1,${size})`);
project.run("list");
project.setSource("map", "l |> map({|x| x})");
project.setContinues("map", ["list"]);
const time = measure(() => {
project.run("map");
});
console.log(`1e${p}`, "\t", time);
}