I guess replace has a fold back method and there is no special implementation for Inline Strings ? Or the constructor of InlineString has to copy the data to new memory ?
replace
uses an IOBuffer
to build up the new string — it’s not simply a fold
call — but every iteration of this benchmark is calling replace
to allocate a new little string. And it’s not specialized for InlineStrings.jl.
I tried it on a recent build of 1.13, and it was about the same speed.