|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
590 bytes
|
| Line | |
|---|
| 1 | 'use strict'
|
|---|
| 2 |
|
|---|
| 3 | var fib = require('./fib')
|
|---|
| 4 | var max = 100000000
|
|---|
| 5 | var start = Date.now()
|
|---|
| 6 |
|
|---|
| 7 | // create a funcion with the typical error
|
|---|
| 8 | // pattern, that delegates the heavy load
|
|---|
| 9 | // to something else
|
|---|
| 10 | function 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 |
|
|---|
| 23 | for (var i = 0; i < max; i++) {
|
|---|
| 24 | createNoCodeFunction()
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | var time = Date.now() - start
|
|---|
| 28 | console.log('Total time', time)
|
|---|
| 29 | console.log('Total iterations', max)
|
|---|
| 30 | console.log('Iteration/s', max / time * 1000)
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.