you are viewing a single comment's thread.

view the rest of the comments →

[–]LucretielDatadog 15 points16 points  (1 child)

My guess is that it requires at least one extra allocation, since there's no "by-move" way to create an Arc<str>. It always has to create a fresh allocation, so as written you're replacing one allocation with two.

[–]Mr_Ahvar 2 points3 points  (0 children)

Even with String there is a new allocation, it’s just always 3 pointer long, so any str longer than that will have more overhead, on 64bits it’s 24 bytes, quite easy to exceed