Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function log(message) {
- document.getElementById('status').textContent += message + '\n';
- }
- log('running...');
- var suite = new Benchmark.Suite;
- // add tests
- suite.add('while', function() {
- while(true) break
- })
- .add('for', function() {
- for(;;) break
- })
- // add listeners
- .on('cycle', function(event) {
- log(String(event.target));
- })
- .on('complete', function() {
- log('Fastest is ' + this.filter('fastest').map('name'));
- })
- // run async
- .run({ 'async': true });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement