execute the benchmark

@param {String} id
@param {Number} iters
5293
function run(id, iters){
  var bench = new Bench(id, ƒ)

  try { Result.when(bench.do(iters), send, error) }
  catch (e) { error(e) }

  function send(result){
    process.send({
      type: 'result',
      value: result,
      id: id
    })
  }

  function error(e){
    process.send({
      type: 'error',
      value: {
        message: e.message,
        stack: e.stack
      },
      id: id
    })
  }
}
1291469
def iter(self):
        
        if self._upperCase:
            for id_ in self._fasta:
                yield self._readClass(id_, str(self._fasta[id_]).upper())
        else:
            for id_ in self._fasta:
                yield self._readClass(id_, str(self._fasta[id_]))
262367
function ( id ) {
		if ( id === undefined || string.isEmpty( id ) ) {
			throw new Error( label.error.invalidArguments );
		}

		// deferred
		if ( utility.timer[id] !== undefined ) {
			clearTimeout( utility.timer[id] );
			delete utility.timer[id];
		}

		// repeating
		if ( utility.repeating[id] !== undefined ) {
			clearTimeout( utility.repeating[id] );
			delete utility.repeating[id];
		}
	}
80254
function (iter, fn) {
      return new Promise(function (resolve) {
        var i = 0;
        function next() {
          return iter.next().then(function (result) {
            if (result.done) {
              return result.value;
            }
            fn(result.value, i++);
            return next();
          });
        }
        resolve(next());
      });
    }
40904
function(id, msg) {
        var q = queues[id];
        // execute failure callback
        if (q.onFailure) {
            var sc=q.scope || q.win;
            q.onFailure.call(sc, _returnData(q, msg));
        }
    }
697868
public void addResults(final String id, final ITimeSyncedIterator iterator) {
    if (id == null) {
      throw new IllegalArgumentException("Missing ID");
    }
    if (iterator == null) {
      throw new IllegalArgumentException("Iterator cannot be null");
    }
    results.put(id, iterator);
  }
613990
def ids_from_seqs_iterative(seqs, app, query_parser, \
    scorer=keep_everything_scorer, max_iterations=None, blast_db=None,\
    max_seqs=None, ):
    
    if isinstance(scorer, int):
        scorer = make_shotgun_scorer(scorer)
    seqs_to_check = list(seqs)
    checked_ids = {}
    curr_iteration = 0
    while seqs_to_check:
        unchecked_ids = {}
        #pass seqs to command
        all_output = app(seqs_to_check)
        output = all_output.get('BlastOut', all_output['StdOut'])

        for query_id, match_id, match_score in query_parser(output):
            if query_id not in checked_ids:
                checked_ids[query_id] = {}
            checked_ids[query_id][match_id] = match_score
            if match_id not in checked_ids:
                unchecked_ids[match_id] = True
        all_output.cleanUp()
        if unchecked_ids:
            seq_file = fasta_cmd_get_seqs(unchecked_ids.keys(),
                app.Parameters['-d'].Value)['StdOut']
            seqs_to_check = []
            for s in FastaCmdFinder(fasta_cmd_get_seqs(\
                unchecked_ids.keys(), app.Parameters['-d'].Value)['StdOut']):
                seqs_to_check.extend(s)
        else:
            seqs_to_check = []
        #bail out if max iterations or max seqs was defined and we've reached it
        curr_iteration += 1
        if max_iterations and (curr_iteration >= max_iterations):
            break
        if max_seqs:
            curr = scorer(checked_ids)
            if len(curr) >= max_seqs:
                return curr
    return scorer(checked_ids)
15877
function each(collection, iterator) {
  for (var i = 0; i < collection.length; i++) {
    iterator(collection[i], i);
  }
}
1255441
def perform_iteration(self):
        """"""
        stats = self.get_all_stats()

        self.redis_client.publish(
            self.redis_key,
            jsonify_asdict(stats),
        )
1119256
public static function run($session_ids, &$context) {
    if (empty($context['sandbox'])) {
      // Perform set-up steps here.
      $context['sandbox']['progress'] = 0;
      $context['sandbox']['max'] = count($session_ids);
    }
    $items_per_iteration = 1;

    $nids = array_slice($session_ids, $context['sandbox']['progress'], $items_per_iteration);
    $sessions = \Drupal::entityTypeManager()
      ->getStorage('node')
      ->loadMultiple($nids);
    $session_instance_manager = \Drupal::service('session_instance.manager');
    foreach ($sessions as $session) {
      $session_instance_manager->recreateSessionInstances($session);
      $context['sandbox']['progress']++;
      $context['results'][] = $session->id();
    }

    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
  }
784336
def compare(self,
                reference_ids: Iterable,
                query_profiles: Iterable[Iterable],
                method: Optional) -> SimResult:
        
        pass
356557
function (command, id) {
        id = id || '';
        if (id) {
          this.queue.push(id);
        }
        SocketService.emit('execute', {
          command: command,
          id: id
        });
      }
18434
public static void run(DBIDs ids, Processor... procs) {
    ParallelCore core = ParallelCore.getCore();
    core.connect();
    try {
      // TODO: try different strategies anyway!
      ArrayDBIDs aids = DBIDUtil.ensureArray(ids);
      final int size = aids.size();
      int numparts = core.getParallelism();
      // TODO: are there better heuristics for choosing this?
      numparts = (size > numparts * numparts * 16) ? numparts * Math.max(1, numparts - 1) : numparts;

      final int blocksize = (size + (numparts - 1)) / numparts;
      List<Future<ArrayDBIDs>> parts = new ArrayList<>(numparts);
      for(int i = 0; i < numparts; i++) {
        final int start = i * blocksize;
        final int end = Math.min(start + blocksize, size);
        Callable<ArrayDBIDs> run = new BlockArrayRunner(aids, start, end, procs);
        parts.add(core.submit(run));
      }

      for(Future<ArrayDBIDs> fut : parts) {
        fut.get();
      }
    }
    catch(ExecutionException e) {
      throw new RuntimeException("Processor execution failed.", e);
    }
    catch(InterruptedException e) {
      throw new RuntimeException("Parallel execution interrupted.");
    }
    finally {
      core.disconnect();
    }
  }
175022
function run(pool, idx, executionFunction) {
  var p = Promise.resolve()
    .then(executionFunction)
    .then(function() {
      delete pool.promises[idx];
      var next = pool.queue.pop();
      if (next) {
        pool.execute(next);
      }
    });
  pool.promises[idx] = p;
  return p;
}
507867
function benchmark( b ) {
		var i;

		b.tic();
		for ( i = 0; i < b.iterations; i++ ) {
			// TODO: synchronous task
			if ( TODO/* TODO: condition */ ) {
				b.fail( 'something went wrong' );
			}
		}
		b.toc();
		if ( TODO/* TODO: condition */ ) {
			b.fail( 'something went wrong' );
		}
		b.pass( 'benchmark finished' );
		b.end();
	}
185614
function(id) {
			var cleared = running[id] != null;
			if (cleared) {
				running[id] = null;
			}

			return cleared;
		}
1096807
function benchmark(name, fn) {

        // Prepare innerloop function
        var innerLoop = eval(
            "(function(f) {" +
            "   return function innerLoop4" + fn.name + "(n) {" +
            "       for (var i = 0; i < n; i++) f()" +
            "   };" +
            "})")(fn);

        // Pre test
        var timeExcess = testTime * 1.1;
        var init = Date.now();
        innerLoop(preTestIterations, fn);
        var elapsed = Date.now() - init + 1;
        var iterations = 0 | Math.min(maxIterations, timeExcess / elapsed * 1000);

        // Test
        var checks = 0;
        var totalIterations = 0;
        init = Date.now();
        do {
            innerLoop(iterations);
            totalIterations += iterations;
            checks++;
            elapsed = Date.now() - init;
            if (elapsed >= testTime) break;
            iterations = 0 | Math.min(maxIterations, (timeExcess - elapsed) / (elapsed + 1) * totalIterations);
        } while (elapsed < testTime);

        // Stats
        var secs = elapsed / 1000;
        var perSecondIterations = 0 | totalIterations / secs;
        if (verbose) {
            console.log('Function "%s" running for %d seconds: %s checks, %s total iterations, %s iterations per second',
                name,
                Math.round(secs * 100) / 100,
                checks,
                totalIterations.toLocaleString(),
                perSecondIterations.toLocaleString()
            );
        }

        // Global stats
        benchmark.results.push({
            name: name,
            elapsed: elapsed,
            checks: checks,
            totalIterations: totalIterations,
            perSecondIterations: perSecondIterations,
            isOptimized: checkOptimization ? isOptimized(fn) : null
        });
        benchmark.results.sort(function (a, b) {
            return b.perSecondIterations - a.perSecondIterations;}
        );
        var max = benchmark.results[0].perSecondIterations;
        benchmark.results.forEach(function (a) {
            return a.diff = Math.round((max - a.perSecondIterations) / max * 10000) / 100 + "%";
        });

    }