I needed some code to create Data from a hex string in Swift, and the first reasonable-looking solution I found on Google was this… https://t.co/YZm2P6E47S …except on closer inspection it's actually O(n^2), which is not great at all.

But the reason it's bad is interesting… pic.twitter.com/JHyeewr1Gc

— Nick Lockwood (@nicklockwood) April 13, 2021