Skip to content

Commit f38fc63

Browse files
committed
Intern short (1..2 chars) contents of TextNode
1 parent f63b07a commit f38fc63

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Orm/Xtensive.Orm/Sql/Compiler/Internals/Nodes/ContainerNode.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ internal override void AcceptVisitor(NodeVisitor visitor)
164164
internal void FlushBuffer()
165165
{
166166
if (stringBuilder.Length > 0) {
167-
children.Add(new TextNode(stringBuilder.ToString()));
167+
var s = stringBuilder.ToString();
168+
if (s.Length < 3) {
169+
s = string.Intern(s);
170+
}
171+
children.Add(new TextNode(s));
168172
lastNodeIsText = true;
169173
lastChar = stringBuilder[^1];
170174
_ = stringBuilder.Clear();

0 commit comments

Comments
 (0)