[SR-7598] Strange performance of String.utf8.map #50140
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Additional Detail from JIRA
md5: 4ce262e34afdb51cfec680c00edb3971
Issue Description:
Further to SR-7511, while trying to generate benchmarks for @milseman I ran into to some rather strange performance issues with
String.utf8.map
.A large string can take minutes for
String.utf8.map
to run, (albeit on my antediluvian MacBook Pro) but if you process the string in some ways, for example, by copying it usinglet chunk = String(testString.prefix(testString.count))
the samemap
function will run in the order of seconds. It is worthwhile notingString.utf16
does not suffer the same problem.The following little program illustrates the problem, run it with no arguments to see the poor performance, with
-chunk
to see good performance.The text was updated successfully, but these errors were encountered: