Advertisement
Guest User

Untitled

a guest
May 27th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. function log(message) {
  2. document.getElementById('status').textContent += message + '\n';
  3. }
  4. log('running...');
  5.  
  6. var suite = new Benchmark.Suite;
  7.  
  8. // add tests
  9. suite.add('while', function() {
  10. while(true) break
  11. })
  12. .add('for', function() {
  13. for(;;) break
  14. })
  15. // add listeners
  16. .on('cycle', function(event) {
  17. log(String(event.target));
  18. })
  19. .on('complete', function() {
  20. log('Fastest is ' + this.filter('fastest').map('name'));
  21. })
  22. // run async
  23. .run({ 'async': true });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement