sampleset benchmark reports errors and accepts SAMPLE_COUNT
This commit is contained in:
parent
35671c5c51
commit
6fc21ddda6
|
@ -4,19 +4,31 @@ import { measure } from "./lib.mjs";
|
||||||
|
|
||||||
const maxP = 3;
|
const maxP = 3;
|
||||||
|
|
||||||
|
const sampleCount = process.env.SAMPLE_COUNT;
|
||||||
|
|
||||||
for (let p = 0; p <= maxP; p++) {
|
for (let p = 0; p <= maxP; p++) {
|
||||||
const size = Math.pow(10, p);
|
const size = Math.pow(10, p);
|
||||||
const project = SqProject.create();
|
const project = SqProject.create();
|
||||||
|
if (sampleCount) {
|
||||||
|
project.setEnvironment({
|
||||||
|
sampleCount: Number(sampleCount),
|
||||||
|
xyPointLength: Number(sampleCount),
|
||||||
|
});
|
||||||
|
}
|
||||||
project.setSource(
|
project.setSource(
|
||||||
"main",
|
"main",
|
||||||
`
|
`
|
||||||
List.upTo(1, ${size}) -> map({|x|
|
List.upTo(1, ${size}) -> map(
|
||||||
normal(x,2) -> SampleSet.fromDist -> PointSet.fromDist
|
{ |x| normal(x,2) -> SampleSet.fromDist -> PointSet.fromDist }
|
||||||
})->List.last
|
)->List.last
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
const time = measure(() => {
|
const time = measure(() => {
|
||||||
project.run("main");
|
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);
|
console.log(`1e${p}`, "\t", time);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user