Skip to content

Commit

Permalink
Update builder.mojo
Browse files Browse the repository at this point in the history
  • Loading branch information
thatstoasty authored May 31, 2024
1 parent 691e127 commit 78404e8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gojo/strings/builder.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ struct StringBuilder[growth_factor: Float32 = 2](Stringable, Sized):
"""
A string builder class that allows for efficient string management and concatenation.
This class is useful when you need to build a string by appending multiple strings
together. It is around 20-30x faster than using the `+` operator to concatenate
strings because it avoids the overhead of creating and destroying many
together. The performance increase is not linear. Compared to string concatenation,
I've observed around 20-30x faster for writing and rending ~4KB and up to 2100x-2300x
for ~4MB. This is because it avoids the overhead of creating and destroying many
intermediate strings and performs memcopy operations.
The result is a more efficient when building larger string concatenations. It
Expand Down

0 comments on commit 78404e8

Please sign in to comment.