CoolFace
Apppublic

strong-tie/inbound-calls

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
reuseNoCodeFunction.js39 linesDownload Raw Back to benchmarks
1'use strict'2 3var reusify = require('../')4var fib = require('./fib')5var instance = reusify(MyObject)6var max = 1000000007var start = Date.now()8 9function reuseNoCodeFunction () {10  var obj = instance.get()11  obj.num = 10012  obj.func()13  obj.num = 014  instance.release(obj)15}16 17function MyObject () {18  this.next = null19  var that = this20  this.num = 021  this.func = function () {22    /* eslint no-constant-condition: "off" */23    if (null) {24      // do nothing25    } else {26      fib(that.num)27    }28  }29}30 31for (var i = 0; i < max; i++) {32  reuseNoCodeFunction()33}34 35var time = Date.now() - start36console.log('Total time', time)37console.log('Total iterations', max)38console.log('Iteration/s', max / time * 1000)39