Skip to content
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

Freeze static strings in QueryParser#normalize_params #989

Merged
merged 1 commit into from
Dec 23, 2015

Conversation

davydovanton
Copy link
Contributor

I used stackprof and minitest/around gems for check all code calls in tests. And I found that Rack::QueryParser#normalize_params has big count of allocated object (figures below).

Before

     TOTAL    (pct)     SAMPLES    (pct)     FRAME
    129136  (19.9%)       10014   (1.5%)     Rack::QueryParser#normalize_params

After

     TOTAL    (pct)     SAMPLES    (pct)     FRAME
     13144   (1.6%)        5802   (0.7%)     Rack::QueryParser#normalize_params

@davydovanton
Copy link
Contributor Author

I don't know why but trevis is broken on this command 😰

The command "sudo apt-get install lighttpd libfcgi-dev libmemcache-dev memcached" failed and exited with 100 during .

@@ -79,16 +80,16 @@ def normalize_params(params, name, v, depth)
raise RangeError if depth <= 0

name =~ %r(\A[\[\]]*([^\[\]]+)\]*)
k = $1 || ''
after = $' || ''
k = $1 || EMPTY_STRING
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just .freeze please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

matthewd added a commit that referenced this pull request Dec 23, 2015
Freeze static strings in QueryParser#normalize_params
@matthewd matthewd merged commit 2ac5995 into rack:master Dec 23, 2015
@davydovanton
Copy link
Contributor Author

Thanks for merge 🎉

@davydovanton davydovanton deleted the reduse-allocation branch December 23, 2015 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants