Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Allocate the "ruby" and "\0" Strings once. #3997

Merged
merged 1 commit into from Sep 24, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/bundler/index.rb
Expand Up @@ -13,6 +13,9 @@ def self.build
attr_reader :specs, :all_specs, :sources
protected :specs, :all_specs

RUBY = "ruby".freeze
NULL = "\0".freeze

def initialize
@sources = []
@cache = {}
Expand Down Expand Up @@ -68,7 +71,7 @@ def search(query, base = nil)
end
end

results.sort_by {|s| [s.version, s.platform.to_s == "ruby" ? "\0" : s.platform.to_s] }
results.sort_by {|s| [s.version, s.platform.to_s == RUBY ? NULL : s.platform.to_s] }
end

def local_search(query, base = nil)
Expand Down