File tree 1 file changed +13
-10
lines changed
1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change 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" ;
6
5
7
6
const newAlea = new Alea ( ) ;
8
7
const oldAlea = OldAlea ( ) ;
9
8
10
- Deno . bench ( "mash-old" , ( ) => {
11
- oldMash ( " " ) ;
9
+ Deno . bench ( "Math.random" , ( ) => {
10
+ Math . random ( ) ;
11
+ } ) ;
12
+
13
+ Deno . bench ( "random" , ( ) => {
14
+ random . float ( ) ;
12
15
} ) ;
13
16
14
- Deno . bench ( "mash-new " , ( ) => {
15
- newMash . mash ( " " ) ;
17
+ Deno . bench ( "xorshift " , ( ) => {
18
+ xorshift . random ( ) ;
16
19
} ) ;
17
20
18
21
Deno . bench ( "alea-old" , ( ) => {
19
22
oldAlea ( ) ;
20
23
} ) ;
21
24
22
- Deno . bench ( "alea-new" , ( ) => {
25
+ Deno . bench ( "alea-new" , { baseline : true } , ( ) => {
23
26
newAlea . random ( ) ;
24
27
} ) ;
You can’t perform that action at this time.
0 commit comments