File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,6 @@ func (g Group) Accept(translator driver.Translator, p eval.Parameter) (query str
121121
122122 // Process each node in the group
123123 for i , node := range g {
124- preLen := builder .Len ()
125124 q , a , err := node .Accept (translator , p )
126125 if err != nil {
127126 return "" , nil , err
@@ -133,10 +132,9 @@ func (g Group) Accept(translator driver.Translator, p eval.Parameter) (query str
133132
134133 // Add space between Nodes, but only if something was written
135134 // and it's not the last node and doesn't already end with space.
136- if i < lastIdx && builder .Len () > preLen {
137- if s := builder .String (); s [len (s )- 1 ] != ' ' {
138- builder .WriteByte (' ' )
139- }
135+ // Check q directly instead of builder.String() to avoid string allocation.
136+ if i < lastIdx && len (q ) > 0 && q [len (q )- 1 ] != ' ' {
137+ builder .WriteByte (' ' )
140138 }
141139 }
142140
You can’t perform that action at this time.
0 commit comments