Sort processors by priority
969478
protected function prepareProcessors()
    {
        usort($this->processors, function (ProcessorInterface $one, ProcessorInterface $two) {
            if ($one->getPriority() == $two->getPriority()) {
                return 0;
            }

            return $one->getPriority() < $two->getPriority() ? 1 : -1;
        });
    }
992443
function ordered (ondelay) {
  var clk = 0
  var queue = []

  var checking = 0
  function check () {
    if (checking++) return

    setImmediate(function () {
      var o = queue.shift()
      clk = o[1]
      ondelay(function () {
        checking = 0
        if (queue.length) check()
        o[0]()
      }, o[2])
    })
  }

  function delay (fn, ms) {
    var len = queue.length, i = 0
    while (queue.length === len) {
      if (queue[i]) {
        if (queue[i][1] > clk + ms) {
          queue.splice(i, 0, [fn, clk + ms, ms])
        }
      } else queue.push([fn, clk + ms, ms])
      ++i
    }
    check()
  }

  return delay
}
698188
public static final <T> void parallelQuickSort(List<T> list, Comparator<T> comparator)
    {
        ForkJoinPool pool = new ForkJoinPool();
        QuickSorter sorter = new QuickSorter(list, 0, list.size()-1, comparator);
        pool.invoke(sorter);
    }
986169
def _sort(self):
        
        self.versions = OrderedDict(sorted(self.versions.items(), key=lambda v: v[0]))
1260471
private void ensureSorted() {
    if (sorted) {
      return;
    }

    ensureCapacity();

    DataUtils.sort(byBlockHash);
    for (int i = 0; i < size; i++) {
      resourceIdsIndex[i] = i;
    }
    DataUtils.sort(byResourceId);

    sorted = true;
  }
237193
function _sorter(a, b){
	// Use aid property priority.
	var bpri = aid.priority(b.property_id());
	var apri = aid.priority(a.property_id());
	return apri - bpri;
    }
1184404
def enqueue item, priority=0
      raise RangeError.new("priority #{priority} is greater than queue size") if priority > self.size
      @array.push PQNode.new(item, priority)
      @array.sort! { |a, b| a.priority <=> b.priority }
    end
239214
def device_priority(cls, device_with_type_tuple):
        
        device, device_type = device_with_type_tuple
        return (device_type is pyopencl.device_type.GPU,
                device.get_info(pyopencl.device_info.GLOBAL_MEM_SIZE),
                )
1052020
public static void sortBy(MutableFst fst, Comparator<Arc> comparator) {
    int numStates = fst.getStateCount();
    for (int i = 0; i < numStates; i++) {
      MutableState s = fst.getState(i);
      s.arcSort(comparator);
    }
  }
33912
protected function sortProviders()
    {
        // fix: uasort(): Array was modified by the user comparison function
        $simpleProviders = [];
        foreach ($this->providers as $name => $provider) {
            $simpleProviders[$name] = $provider->getPriority();
        }
        asort($simpleProviders);
        $providers = [];
        foreach ($simpleProviders as $name => $priority) {
            $providers[$name] = $this->providers[$name];
        }
        $this->providers = $providers;
    }
485625
def list_processors(self, instance=None):
        
        # Server does not do pagination on listings of this resource.
        # Return an iterator anyway for similarity with other API methods
        url = '/processors'
        if instance:
            url += '/' + instance
        response = self.get_proto(path=url)
        message = rest_pb2.ListProcessorsResponse()
        message.ParseFromString(response.content)
        processors = getattr(message, 'processor')
        return iter([Processor(processor) for processor in processors])
516259
def priority(self, item):
        
        return '%.1f' % max(self.cache[item.pk][0] / self.max_entries, 0.1)
212464
private int getPriority(final ExecutableFlow exflow) {
    final ExecutionOptions options = exflow.getExecutionOptions();
    int priority = ExecutionOptions.DEFAULT_FLOW_PRIORITY;
    if (options != null
        && options.getFlowParameters() != null
        && options.getFlowParameters()
        .containsKey(ExecutionOptions.FLOW_PRIORITY)) {
      try {
        priority =
            Integer.valueOf(options.getFlowParameters().get(
                ExecutionOptions.FLOW_PRIORITY));
      } catch (final NumberFormatException ex) {
        priority = ExecutionOptions.DEFAULT_FLOW_PRIORITY;
        logger.error(
            "Failed to parse flow priority for exec_id = "
                + exflow.getExecutionId(), ex);
      }
    }
    return priority;
  }
661432
def priority=(val)
      no_cmd = (val == default_priority) ? 'no' : ''
      pri = (val == default_priority) ? '' : val
      config_set('interface_ospf', 'priority',
                 @interface.name, no_cmd, pri)
    end
332678
private function getSortedProcessors($action, $actionData, $groups)
    {
        $processors = [];
        foreach ($actionData as $priority => $priorityData) {
            foreach ($priorityData as $processor) {
                if (isset($processor[1][self::GROUP_ATTRIBUTE])) {
                    $group = $processor[1][self::GROUP_ATTRIBUTE];
                    if (!isset($groups[$action][$group])) {
                        throw new \RuntimeException(
                            \sprintf(
                                'The group "%s" is not defined. Processor: "%s".',
                                $group,
                                $processor[0]
                            )
                        );
                    }
                    $groupPriority = $groups[$action][$group];
                    $processorPriority = self::calculatePriority($priority, $groupPriority);
                } else {
                    $processorPriority = self::calculatePriority($priority);
                }
                $processors[$processorPriority][] = $processor;
            }
        }
        $processors = $this->sortByPriorityAndFlatten($processors);

        return $processors;
    }
1372096
def add_processor(self, processor_instance: Processor, priority=0) -> None:
        
        assert issubclass(processor_instance.__class__, Processor)
        processor_instance.priority = priority
        processor_instance.world = self
        self._processors.append(processor_instance)
        self._processors.sort(key=lambda proc: proc.priority, reverse=True)
496080
function(cpuSlice) {
      var i = tr.b.findLowIndexInSortedArray(
          this.slices,
          function(slice) { return slice.start; },
          cpuSlice.start);
      if (this.slices[i] !== cpuSlice)
        return undefined;
      return i;
    }