source: imaps-frontend/node_modules/reusify/benchmarks/createNoCodeFunction.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 590 bytes
Line 
1'use strict'
2
3var fib = require('./fib')
4var max = 100000000
5var start = Date.now()
6
7// create a funcion with the typical error
8// pattern, that delegates the heavy load
9// to something else
10function createNoCodeFunction () {
11 /* eslint no-constant-condition: "off" */
12 var num = 100
13
14 ;(function () {
15 if (null) {
16 // do nothing
17 } else {
18 fib(num)
19 }
20 })()
21}
22
23for (var i = 0; i < max; i++) {
24 createNoCodeFunction()
25}
26
27var time = Date.now() - start
28console.log('Total time', time)
29console.log('Total iterations', max)
30console.log('Iteration/s', max / time * 1000)
Note: See TracBrowser for help on using the repository browser.