forked from processing/p5.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
processing#1524 added first example benchmark
- Loading branch information
1 parent
d98c233
commit e617329
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* global suite, benchmark */ | ||
let p5Inst; | ||
|
||
/** | ||
* Compare the p5 random() function to the native Math.random() | ||
*/ | ||
suite('p5 random() vs Math.random()', function () { | ||
benchmark('p5 random()', function () { | ||
return p5Inst.random(); | ||
}); | ||
|
||
benchmark('Math.random()', function () { | ||
return Math.random(); | ||
}); | ||
}, { | ||
onStart: function() { | ||
p5Inst = new p5(); | ||
}, | ||
}); |