Is advocating (strict) Text
not premature optimisation ?
I love String
, the API is great (in the Prelude, can use all List
functions without import, name clashes etc, can pattern match, lazy) and most of the time quick enough. So in my opinion they are not only “good enough” but actually better than Text
. The only advantage of Text
is potential performance gain that I usually can not see or care.
When I encounter a performance issue, then I switch to Text
but then I am not even sure than strict Text
is the best. When talking about Text
people then talk about Builder
or list of strict Text
, is it not what Lazy.Text
is (a list of strict Text
) ?. Lazy Text
seem to me the best of both worlds (why would I waste time copying a two strings to concatenate them when I can just keep the two in memory).
Do we actually have evidence that strict Text perform better than lazy ones ?
In a ideal world, the compiler should be able to map internally String
to Lazy.Text
or at least be able to allocate a full literal string in one chunk.