Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Faster string comparison functions in StringUtils
The methods EqualsNoCase(), StartsWith() and EndsWith() required quite a lot of unncessary creation and destruction of std::strings, whether it be the creation of a temporary copy that could be forced to lower-case, a temporary copy that was a substring of one of the inputs, or just marshalling a string literal argument into a std::string. These functions don't appear to be used all that much at the moment; when I profiled opening the songs library, I saw only a 1% improvement, which was within the sampling noise threshold. But with PR #3225 and PR #3290 coming along, that looks set to change. Once the functions are being called millions of times, those heap operations really start to get noticeable. Also, split StartsWith() and EndsWith() into multiple separately-named functions, according to case sensitivity. Formerly, there was an optional parameter (default off) to indicate that these operations were case-*sensitive*, which is actually computationally simpler to perform. Now the naming convention is consistent with EqualsNoCase: StartsWith - case-sensitive EndsWith - case-sensitive StartsWithNoCase - case-insensitive EndsWithNoCase - case-insensitive With the case-sensitive versions now easier to type, it will hopefully encourage future developers to use them in preference.
- Loading branch information
Showing
23 changed files
with
194 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.