source: trip-planner-front/node_modules/reusify/benchmarks/createNoCodeFunction.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 590 bytes
RevLine 
[6a3a178]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.