Open
Conversation
added 5 commits
August 10, 2015 12:19
Using the enum rather than string comparisons as the match progresses should save cycles.
- Don't use strtok -- we only care about the last token anyway which means we can just find where that token begins. - If we are scanning rather than tokenizing we can look for both '\\' and '/' so we don't need to modify the string. - If we don't modify the string we don't need to make a copy.
ptzz
reviewed
Dec 9, 2017
| pch = strtok(NULL, "/"); | ||
| char *fname = line; | ||
| char *scan = fname; | ||
| while (scan != '\0') |
There was a problem hiding this comment.
Crashes for me. I think it should be while (*scan != '\0').
Closed
|
@telemenar This is good stuff, thanks! I forked your repo to https://github.com/ptzz/ctrlp-cmatcher and optimised further. Managed to cut the processing time by ~80% for large input. The delay is not really noticeable now for 100k files on a 2012 Macbook. The trick was to use partial sort and only sort the items visible on screen. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes a number of performance improvements avoiding largely copying and additional comparison.
The two most significant pieces are: