Skip to content

Commit 17306fc

Browse files
committed
Always split String#<< to specialize encoding negotiation and TruffleString.ConcatNode per call site
* Encoding negotiation is more efficient that way. * That way ConcatNode will see much less polymorphism between empty left, empty right, total length < LAZY_CONCAT_MIN_LENGTH, MutableTruffleString, etc. * Similar reasoning to to Array#<<.
1 parent 6e8dd4a commit 17306fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/truffleruby/core/string/StringNodes.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
import org.jcodings.specific.ASCIIEncoding;
102102
import org.truffleruby.Layouts;
103103
import org.truffleruby.annotations.CoreMethod;
104+
import org.truffleruby.annotations.Split;
104105
import org.truffleruby.builtins.CoreMethodArrayArgumentsNode;
105106
import org.truffleruby.annotations.CoreModule;
106107
import org.truffleruby.annotations.Primitive;
@@ -417,7 +418,7 @@ RubyString dupAsStringInstance(Object string,
417418
}
418419
}
419420

420-
@CoreMethod(names = "<<", required = 1, raiseIfNotMutableSelf = true)
421+
@CoreMethod(names = "<<", required = 1, raiseIfNotMutableSelf = true, split = Split.ALWAYS)
421422
@ImportStatic(StringGuards.class)
422423
public abstract static class StringConcatOneNode extends CoreMethodArrayArgumentsNode {
423424

0 commit comments

Comments
 (0)