Skip to content

Commit

Permalink
EnsureCapacity when writing SynConst.Strings
Browse files Browse the repository at this point in the history
  • Loading branch information
vipentti committed Dec 23, 2023
1 parent 5d21083 commit 43a62a6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Visp.Compiler/Syntax/Syntax.fs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ type SynConst =
| Decimal it -> sprintf "Decimal %A" it
| String(text, k, r) ->
let sb = PooledStringBuilder.Get()
// Reserve capacity for the text + all the extra data being written
sb.EnsureCapacity(text.Length + 60) |> ignore
sb.Append "String (\"" |> ignore

for ch in text do
Expand Down

0 comments on commit 43a62a6

Please sign in to comment.