Skip to content

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

Merged
RobertGummesson merged 1 commit intoRobertGummesson:masterfrom
LuizZak:avoid_characters_count
Mar 31, 2017
Merged

Use NSString’s length instead of String.CharacterView.count, since we…#62
RobertGummesson merged 1 commit intoRobertGummesson:masterfrom
LuizZak:avoid_characters_count

Conversation

@LuizZak
Copy link
Copy Markdown
Contributor

@LuizZak LuizZak commented Mar 30, 2017

…’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!

…’re going to use the range in an NSMakeRange call anyways
@RobertGummesson
Copy link
Copy Markdown
Owner

Thanks. That's interesting.

@RobertGummesson RobertGummesson merged commit c942323 into RobertGummesson:master Mar 31, 2017
@LuizZak LuizZak deleted the avoid_characters_count branch February 17, 2018 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants