[SR-14102] Idiomatic way of checking if an Array<UInt8> starts with a bunch of bytes is slow #56488
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
performance
Attachment: Download
Environment
Additional Detail from JIRA
md5: cbaa9373048befa9b532f9d0f5ae9bbb
Issue Description:
Consider this code:
You'd assume that Swift can do better than building three arrays and then doing
starts(with🙂
on them. However, that's not the case...What's incredibly baffling is that if you rewrite it using Strings, then it generates much better code:
Unfortunately that's super awkward and only works for unicode code units that are the same as their ASCII value, so I think that's 0 ... 127.
See here: the
stringIt
code has aretq
before anycallq
The text was updated successfully, but these errors were encountered: