RobertGummesson / BuildTimeAnalyzer-for-Xcode

Build Time Analyzer for Swift
MIT License
4.3k stars 260 forks source link

Use NSString’s length instead of String.CharacterView.count, since we… #62

Closed LuizZak closed 7 years ago

LuizZak commented 7 years ago

…’re going to use the range in an NSMakeRange call anyways

String.CharacterView's count is taking 40% of the time parsing the logs:

captura de tela 2017-03-30 as 19 00 27

Simply changing a line to use NSString's length property improves the performance by about 2x:

captura de tela 2017-03-30 as 19 14 58

There's still a lot of time being spent with rangeOfCharacters, seems to be related to retain/releases, but this is a good starting improvement!

RobertGummesson commented 7 years ago

Thanks. That's interesting.