New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce object allocations in Rack::Utils #795

Merged
merged 1 commit into from Feb 11, 2015
Jump to file or symbol
Failed to load files and symbols.
+2 −1
Diff settings

Always

Just for now

View
@@ -109,6 +109,7 @@ def parse_query(qs, d = nil, &unescaper)
# ParameterTypeError is raised. Users are encouraged to return a 400 in this
# case.
def parse_nested_query(qs, d = nil)
return {} if qs.empty?
params = KeySpaceConstrainedParams.new
(qs || '').split(d ? /[#{d}] */n : DEFAULT_SEP).each do |p|
@@ -495,7 +496,7 @@ def [](k)
end
def []=(k, v)
canonical = k.downcase
canonical = k.downcase.freeze
delete k if @names[canonical] && @names[canonical] != k # .delete is expensive, don't invoke it unless necessary
@names[k] = @names[canonical] = k
super k, v