rate limiting. Thus we don't have to care about using iterative methods vs recursion here.
325274
private static void publish(Logger logger, LogRecord record) {
    // Annoyingly this method appears to copy the array every time it is called, but there's
    // nothing much we can do about this (and there could be synchronization issues even if we
    // could access things directly because handlers can be changed at any time). Most of the
    // time this returns the singleton empty array however, so it's not as bad as all that.
    for (Handler handler : logger.getHandlers()) {
      handler.publish(record);
    }
    if (logger.getUseParentHandlers()) {
      logger = logger.getParent();
      if (logger != null) {
        publish(logger, record);
      }
    }
  }
603201
private final V process(final Iterable<DiceNotationExpression> nodes) {

        accumulator.reset();

        for (final DiceNotationExpression current : nodes) {
            if (current instanceof BinaryOperation) {
                accumulator.binaryOperation((BinaryOperation) current);
            } else if (current instanceof ConstantOperand) {
                accumulator.constantOperand((ConstantOperand) current);
            } else if (current instanceof DiceOperand) {
                accumulator.diceOperand((DiceOperand) current);
            } else {
                LOGGER.warn("Unsupported expression of type {}",
                        current.getClass());
            }
        }

        return accumulator.getValue();
    }
409814
def do_less_expensive_things(number):
    
    result = yield batch_accumulate(1000, expensive(number))
    total = reduce(add, result, 0)
    log.msg("only for {}: {}".format(number, total))
    defer.returnValue(total)
877454
def limit(self, n):
    
    data = self._data
    self._data = (next(data) for _ in xrange(int(round(n))))
    return self
395380
function (rate) {
      var value = parseFloat(rate);
      if (this._contains(value)) {
        this._fillUntil(this._rateToIndex(value));
        this.$input.val(value);
      } else if (rate === '') {
        this._fillUntil(0);
        this.$input.val('');
      }
    }
555252
function walkRecursive(array, callback) {
	for (var i = 0, c = array.length; i < c; i++) {
		if (_.isObject(array[i].f)) {
			if (walkRecursive(array[i].f, callback) === false) {
				return false;
			}
		} else if (callback(array[i], i, array) === false) {
			return false;
		}
	}
}
1225639
function computeInner(iterations) {
    var dummy = 0;
    for (var n = 0; n < iterations; n++) {
      // We don't have to worry about this being entirely removed (yet), as
      // JITs don't seem to consider now() as not having side-effects.
      dummy += wtf.now();
    }
    return dummy;
  }
227111
def non_increasing(values):
    """"""
    return all(x >= y for x, y in zip(values, values[1:]))
422920
public static final BigDecimal printRate(Rate rate)
   {
      BigDecimal result = null;
      if (rate != null && rate.getAmount() != 0)
      {
         result = new BigDecimal(rate.getAmount());
      }
      return result;
   }
635146
function (key, intervalSize, limit) {
        var deferred = Q.defer()
            , memcached = Shared.memcached();
        if (!memcached) {
            deferred.reject();
        }
        else {
            //Get current rate for ip
            memcached.get(key, function (err, value) {
                if (err) {
                    //Allow access as failover
                    Logger.warn("Rate limit set but memcached error, allow access without limit", err);
                    deferred.reject();
                }
                else if (_.isUndefined(value)) {
                    memcached.set(key, 1, 60 * intervalSize, function (err) {
                        if (err) {
                            Logger.warn("Rate limit set but memcached error, allow access without limit", err);
                        }
                    });
                    deferred.resolve(1);
                }
                else {
                    //Do not increase rate counter if exceeded anyway
                    if (value < limit) {
                        // Increase rate counter by 1
                        memcached.incr(key, 1, function (err) {
                            if (err) {
                                Logger.warn("Rate limit set but memcached error, allow access without limit", err);
                            }
                        });
                    }
                    deferred.resolve(value + 1);
                }
            });
        }
        return deferred.promise;
    }
631251
def rate_limiting(self):
        
        remaining, limit = self.__requester.rate_limiting
        if limit < 0:
            self.get_rate_limit()
        return self.__requester.rate_limiting
991397
private boolean reducing() {
        if (this.limits.reduceRedundant == 0) { this.limits.reduceRedundant = this.config.redinit; }
        long limit = this.limits.reduceRedundant;
        limit += this.limits.reduceForcing;
        limit += this.limits.reduceImportant;
        return limit <= this.stats.clausesRedundant;
    }
1138079
function smaller(tree, n, m, depth) {
  var _n2 = n * 2;
  var _m2 = m * 2;
  return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||
         (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));
}
160597
def iterslice(iterable, start=0, stop=None, step=1):
    # type: (Iterable[T], int, int, int) -> Iterable[T]
    

    if step < 0:
        raise ValueError("The step can not be negative: '%s' given" % step)

    if not isinstance(start, int):

        # [Callable:Callable]
        if not isinstance(stop, int) and stop:
            return stops_when(starts_when(iterable, start), stop)

        # [Callable:int]
        return starts_when(itertools.islice(iterable, None, stop, step), start)

    # [int:Callable]
    if not isinstance(stop, int) and stop:
        return stops_when(itertools.islice(iterable, start, None, step), stop)

    # [int:int]
    return itertools.islice(iterable, start, stop, step)
550383
public boolean iterate() {
		boolean converged;
		switch( mode ) {
			case COMPUTE_DERIVATIVES:
				totalFullSteps++;
				converged = updateDerivates();
				if( !converged ) {
					totalSelectSteps++;
					converged = computeStep();
				}
				break;

			case DETERMINE_STEP:
				totalSelectSteps++;
				converged = computeStep();
				break;

			case CONVERGED:
				return true;

			default:
				throw new RuntimeException("BUG! mode="+mode);
		}

		if( converged ) {
			mode = Mode.CONVERGED;
			return true;
		} else {
			return false;
		}
	}
600339
function() {
            var lc = this.lc(), l = this.coeffs.length; 
            for(var i=0; i<l; i++) this.coeffs[i] = this.coeffs[i].divide(lc);
            return this;
        }
919029
private Node tryMinimizeIf(Node n) {

    Node parent = n.getParent();

    Node originalCond = n.getFirstChild();

    /* If the condition is a literal, we'll let other
     * optimizations try to remove useless code.
     */
    if (NodeUtil.isLiteralValue(originalCond, true)) {
      return n;
    }

    Node thenBranch = originalCond.getNext();
    Node elseBranch = thenBranch.getNext();

    MinimizedCondition minCond = MinimizedCondition.fromConditionNode(originalCond);

    // Compute two minimized representations. The first representation counts
    // a leading NOT node, and the second ignores a leading NOT node.
    // If we can fold the if statement into a HOOK or boolean operation,
    // then the NOT node does not matter, and we prefer the second condition.
    // If we cannot fold the if statement, then we prefer the first condition.
    MeasuredNode unnegatedCond = minCond.getMinimized(MinimizationStyle.PREFER_UNNEGATED);
    MeasuredNode shortCond = minCond.getMinimized(MinimizationStyle.ALLOW_LEADING_NOT);

    if (elseBranch == null) {
      if (isFoldableExpressBlock(thenBranch)) {
        Node expr = getBlockExpression(thenBranch);
        if (!late && isPropertyAssignmentInExpression(expr)) {
          // Keep opportunities for CollapseProperties such as
          // a.longIdentifier || a.longIdentifier = ... -> var a = ...;
          // until CollapseProperties has been run.
          replaceNode(originalCond, unnegatedCond);
          return n;
        }

        if (shortCond.isNot()) {
          // if(!x)bar(); -> x||bar();
          Node replacementCond = replaceNode(originalCond, shortCond.withoutNot()).detach();
          Node or = IR.or(
              replacementCond,
              expr.removeFirstChild()).srcref(n);
          Node newExpr = NodeUtil.newExpr(or);
          parent.replaceChild(n, newExpr);
          reportChangeToEnclosingScope(parent);

          return newExpr;
        }
        // True, but removed for performance reasons.
        // Preconditions.checkState(shortCond.isEquivalentTo(unnegatedCond));

        // if(x)foo(); -> x&&foo();
        if (shortCond.isLowerPrecedenceThan(AND_PRECEDENCE)
            && isLowerPrecedence(expr.getFirstChild(), AND_PRECEDENCE)) {
          // One additional set of parentheses is worth the change even if
          // there is no immediate code size win. However, two extra pair of
          // {}, we would have to think twice. (unless we know for sure the
          // we can further optimize its parent.
          replaceNode(originalCond, shortCond);
          return n;
        }

        Node replacementCond = replaceNode(originalCond, shortCond).detach();
        Node and = IR.and(replacementCond, expr.removeFirstChild()).srcref(n);
        Node newExpr = NodeUtil.newExpr(and);
        parent.replaceChild(n, newExpr);
        reportChangeToEnclosingScope(parent);

        return newExpr;
      } else {

        // Try to combine two IF-ELSE
        if (NodeUtil.isStatementBlock(thenBranch) && thenBranch.hasOneChild()) {
          Node innerIf = thenBranch.getFirstChild();

          if (innerIf.isIf()) {
            Node innerCond = innerIf.getFirstChild();
            Node innerThenBranch = innerCond.getNext();
            Node innerElseBranch = innerThenBranch.getNext();

            if (innerElseBranch == null
                 && !(unnegatedCond.isLowerPrecedenceThan(AND_PRECEDENCE)
                   && isLowerPrecedence(innerCond, AND_PRECEDENCE))) {
              Node replacementCond = replaceNode(originalCond, unnegatedCond).detach();
              n.detachChildren();
              n.addChildToBack(
                  IR.and(
                      replacementCond,
                      innerCond.detach())
                      .srcref(originalCond));
              n.addChildToBack(innerThenBranch.detach());
              reportChangeToEnclosingScope(n);
              // Not worth trying to fold the current IF-ELSE into && because
              // the inner IF-ELSE wasn't able to be folded into && anyways.
              return n;
            }
          }
        }
      }
      replaceNode(originalCond, unnegatedCond);
      return n;
    }

    /* TODO(dcc) This modifies the siblings of n, which is undesirable for a
     * peephole optimization. This should probably get moved to another pass.
     */
    tryRemoveRepeatedStatements(n);

    // if(!x)foo();else bar(); -> if(x)bar();else foo();
    // An additional set of curly braces isn't worth it.
    if (shortCond.isNot() && !consumesDanglingElse(elseBranch)) {
      replaceNode(originalCond, shortCond.withoutNot());
      n.removeChild(thenBranch);
      n.addChildToBack(thenBranch);
      reportChangeToEnclosingScope(n);
      return n;
    }

    // if(x)return 1;else return 2; -> return x?1:2;
    if (isReturnExpressBlock(thenBranch) && isReturnExpressBlock(elseBranch)) {
      Node thenExpr = getBlockReturnExpression(thenBranch);
      Node elseExpr = getBlockReturnExpression(elseBranch);

      Node replacementCond = replaceNode(originalCond, shortCond).detach();
      thenExpr.detach();
      elseExpr.detach();

      // note - we ignore any cases with "return;", technically this
      // can be converted to "return undefined;" or some variant, but
      // that does not help code size.
      Node returnNode = IR.returnNode(
                            IR.hook(replacementCond, thenExpr, elseExpr)
                                .srcref(n));
      parent.replaceChild(n, returnNode);
      reportChangeToEnclosingScope(returnNode);
      return returnNode;
    }

    boolean thenBranchIsExpressionBlock = isFoldableExpressBlock(thenBranch);
    boolean elseBranchIsExpressionBlock = isFoldableExpressBlock(elseBranch);

    if (thenBranchIsExpressionBlock && elseBranchIsExpressionBlock) {
      Node thenOp = getBlockExpression(thenBranch).getFirstChild();
      Node elseOp = getBlockExpression(elseBranch).getFirstChild();
      if (thenOp.getToken() == elseOp.getToken()) {
        // if(x)a=1;else a=2; -> a=x?1:2;
        if (NodeUtil.isAssignmentOp(thenOp)) {
          Node lhs = thenOp.getFirstChild();
          if (areNodesEqualForInlining(lhs, elseOp.getFirstChild())
              // if LHS has side effects, don't proceed [since the optimization
              // evaluates LHS before cond]
              // NOTE - there are some circumstances where we can
              // proceed even if there are side effects...
              && !mayEffectMutableState(lhs)
              && (!mayHaveSideEffects(originalCond)
                  || (thenOp.isAssign() && thenOp.getFirstChild().isName()))) {

            Node replacementCond = replaceNode(originalCond, shortCond).detach();
            Node assignName = thenOp.removeFirstChild();
            Node thenExpr = thenOp.removeFirstChild();
            Node elseExpr = elseOp.getLastChild();
            elseOp.removeChild(elseExpr);

            Node hookNode = IR.hook(replacementCond, thenExpr, elseExpr)
                .srcref(n);
            Node assign = new Node(thenOp.getToken(), assignName, hookNode).srcref(thenOp);
            Node expr = NodeUtil.newExpr(assign);
            parent.replaceChild(n, expr);
            reportChangeToEnclosingScope(parent);

            return expr;
          }
        }
      }
      // if(x)foo();else bar(); -> x?foo():bar()
      Node replacementCond = replaceNode(originalCond, shortCond).detach();
      thenOp.detach();
      elseOp.detach();
      Node expr = IR.exprResult(
          IR.hook(replacementCond, thenOp, elseOp).srcref(n));
      parent.replaceChild(n, expr);
      reportChangeToEnclosingScope(parent);
      return expr;
    }

    boolean thenBranchIsVar = isVarBlock(thenBranch);
    boolean elseBranchIsVar = isVarBlock(elseBranch);

    // if(x)var y=1;else y=2  ->  var y=x?1:2
    if (thenBranchIsVar && elseBranchIsExpressionBlock
        && getBlockExpression(elseBranch).getFirstChild().isAssign()) {

      Node var = getBlockVar(thenBranch);
      Node elseAssign = getBlockExpression(elseBranch).getFirstChild();

      Node name1 = var.getFirstChild();
      Node maybeName2 = elseAssign.getFirstChild();

      if (name1.hasChildren()
          && maybeName2.isName()
          && name1.getString().equals(maybeName2.getString())) {
        checkState(name1.hasOneChild());
        Node thenExpr = name1.removeFirstChild();
        Node elseExpr = elseAssign.getLastChild().detach();
        Node replacementCond = replaceNode(originalCond, shortCond).detach();
        Node hookNode = IR.hook(replacementCond, thenExpr, elseExpr).srcref(n);
        var.detach();
        name1.addChildToBack(hookNode);
        parent.replaceChild(n, var);
        reportChangeToEnclosingScope(parent);
        return var;
      }

    // if(x)y=1;else var y=2  ->  var y=x?1:2
    } else if (elseBranchIsVar && thenBranchIsExpressionBlock
        && getBlockExpression(thenBranch).getFirstChild().isAssign()) {

      Node var = getBlockVar(elseBranch);
      Node thenAssign = getBlockExpression(thenBranch).getFirstChild();

      Node maybeName1 = thenAssign.getFirstChild();
      Node name2 = var.getFirstChild();

      if (name2.hasChildren()
          && maybeName1.isName()
          && maybeName1.getString().equals(name2.getString())) {
        Node thenExpr = thenAssign.getLastChild().detach();
        checkState(name2.hasOneChild());
        Node elseExpr = name2.removeFirstChild();
        Node replacementCond = replaceNode(originalCond, shortCond).detach();
        Node hookNode = IR.hook(replacementCond, thenExpr, elseExpr).srcref(n);
        var.detach();
        name2.addChildToBack(hookNode);
        parent.replaceChild(n, var);
        reportChangeToEnclosingScope(parent);

        return var;
      }
    }

    replaceNode(originalCond, unnegatedCond);
    return n;
  }