Skip to content

Commit

Permalink
processing#1524 added first example benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared-Sprague committed Oct 30, 2017
1 parent d98c233 commit e617329
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions bench/random.bench.js
@@ -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();
},
});

0 comments on commit e617329

Please sign in to comment.