Skip to content

Reduced the number of String allocations for the NONE parameterList case.#1399

Merged
headius merged 1 commit intojruby:jruby-1_7from
nirvdrum:reduce_string_duplication
Jan 13, 2014
Merged

Reduced the number of String allocations for the NONE parameterList case.#1399
headius merged 1 commit intojruby:jruby-1_7from
nirvdrum:reduce_string_duplication

Conversation

@nirvdrum
Copy link
Contributor

Please double-check me on this, but I think previously "NONE" would only be appended if the builder was empty. Rather than append to the builder and convert to a String, which will allocate a new copy of the String, I just return the String literal directly. In a sample of a production app that was up for < 15 min., I had 6,346 copies of this String.

@headius
Copy link
Member

headius commented Jan 13, 2014

The patch is good. I'm not sure 6k strings is going to be a substantial hit, but we might as well not be wasteful. Does this number continue to go up after JIT settles down?

headius added a commit that referenced this pull request Jan 13, 2014
Reduced the number of String allocations for the NONE parameterList case.
@headius headius merged commit 8b7a6f9 into jruby:jruby-1_7 Jan 13, 2014
@nirvdrum
Copy link
Contributor Author

TorqueBox slows to a crawl when I enable the YourKit agent so I couldn't leave this running in production for much longer. It probably wasn't super significant, but as you hinted, I also had no idea if it ever caps off. I took it to mean there was extra allocations on all non-JITted calls with empty params.

@enebo enebo added this to the JRuby 1.7.11 milestone Feb 21, 2014
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.

3 participants