Skip to content

Commit 153b31e

Browse files
committedJul 3, 2024
add more benchmarks
1 parent ff7008a commit 153b31e

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed
 

‎mod.bench.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
import OldAlea, { OldMash } from "./mod.old.ts";
2-
import Alea, { Mash } from "./mod.ts";
3-
4-
const newMash = new Mash();
5-
const oldMash = OldMash();
1+
import OldAlea from "./mod.old.ts";
2+
import Alea from "./mod.ts";
3+
import xorshift from "https://esm.sh/xorshift@1.2.0";
4+
import random from "https://esm.sh/random@4.1.0";
65

76
const newAlea = new Alea();
87
const oldAlea = OldAlea();
98

10-
Deno.bench("mash-old", () => {
11-
oldMash(" ");
9+
Deno.bench("Math.random", () => {
10+
Math.random();
11+
});
12+
13+
Deno.bench("random", () => {
14+
random.float();
1215
});
1316

14-
Deno.bench("mash-new", () => {
15-
newMash.mash(" ");
17+
Deno.bench("xorshift", () => {
18+
xorshift.random();
1619
});
1720

1821
Deno.bench("alea-old", () => {
1922
oldAlea();
2023
});
2124

22-
Deno.bench("alea-new", () => {
25+
Deno.bench("alea-new", { baseline: true }, () => {
2326
newAlea.random();
2427
});

0 commit comments

Comments
 (0)
Please sign in to comment.