Closed lobianco closed 11 years ago
I totally agree with you. The code you mentioned needs some refactoring.
Well I decided to roll my own. I was able to improve performance significantly but I still think there's room for improvement. Nevertheless, you can see what I did here:
I noticed that you're iterating over every single character of the code string, and subsequently appending each new character to its corresponding element. This uses a huge amount of memory and will actually crash the app if the string is too long. Have you considered refactoring your code to use more appropriate methods, like
rangeOfCharacterFromSet:
, etc?