Add form-feed and vertical tab to trim defaults#2407
Conversation
|
I know it's tradition, but no one uses those. |
But what if someone did? 😏 jokes aside, it would be good to grab as much actual ASCII whitespace as possible with the default value, right? |
|
No, because it makes the filtering slower in this implementation. It's O(n) based on length. |
|
Not that it will matter that much. If we used character sets directly it would be faster. I can make a fast trim that outperforms the current one by a factor 3. |
|
Alright, I'm now finished amending this pull request. I added/fixed the benchmark (as well as the bench runtime). It now lines up with what you posted in Discord, per our discussion there. Main takeaway: AsciiCharset is the clear victor for trimming regardless of the set size, but the charset trimming gets exponentially faster the larger the filter set is. |
Add a few extra characters to the collection of default whitespace values in String
trimmethods.See: C++'s
std::isspaceand C'sisspace.