mrataj / BBCodeParser

BBCode (BulletinBoard code) parser for Objective-C.
MIT License
28 stars 10 forks source link

Crashes on long strings #2

Closed lobianco closed 11 years ago

lobianco commented 11 years ago

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?

mrataj commented 11 years ago

I totally agree with you. The code you mentioned needs some refactoring.

lobianco commented 11 years ago

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:

https://github.com/Alobi/BBCodeParser