Skip to content


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

merged 1 commit into from

3 participants


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.

JRuby Team member

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 headius merged commit 8b7a6f9 into jruby:jruby-1_7

1 check failed

Details default The Travis CI build failed

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 3 additions and 1 deletion.
  1. +3 −1 core/src/main/java/org/jruby/runtime/
4 core/src/main/java/org/jruby/runtime/
@@ -2703,7 +2703,9 @@ public static String encodeParameterList(ArgsNode argsNode) {
- if (!added) builder.append("NONE");
+ if (!added) {
+ return "NONE";
+ }
return builder.toString();
Something went wrong with that request. Please try again.