When using "Goto file..." (Alt+G) feature on Code::Blocks workspace there is notable delay between pressing Alt+G and actual dialog show. It's about one second on AMD FX-8350 processor. Provided optimization significantly reduces delay, especially when workspace consists of many files in nested subdirectories.
Creation of such minor optimization was inspired by 10772 commit: "because we can handle it: added Java wizards for fun". So I decided to test whether opening of similar dialog in the Eclipse is slow or not. It opens immediately in the Eclipse, thats why this dialog must be opened quickly in Code::Blocks also.
Are you sure this patch doesn't change the behaviour?
Because as far as I can see you've changed the comparison function.
Do you have a sample project to test the optimization?
Optimization does not change the bahaviour, because first we sort vector by absolute path, then we remove consecutive duplicates and finally sort the vector by relative path.
Comparator was changed for first sorting, here is enough to sort in that way, so duplicates will follow each other.
If we compare file names prior to directories then we get a performance gain.
So finally sorting became 5-6 times faster. Here is an exapmple of few files from Code::Blocks workspace:
d:\Work\codeblocks\src\plugins\codecompletion\parser\token.h
d:\Work\codeblocks\src\plugins\codecompletion\parser\tokenizer.h
d:\Work\codeblocks\src\plugins\codecompletion\parser\tokentree.h
To test optimization you can open Code::Blocks workspace, add to project empty tokentree.h file in d:\Work\codeblocks\src\ directory, then select tokentree.h via Alg+G and ensure both tokentree.h files are displayed in the list.
Possibly we can optimize even more if remove first sorting, but there is need to add some unit test or example workspace into repository.
Do you have a sample project you've tested the optimization and you've measured the improvement?
I have no sample project. I've tested it on the Code::Blocks workspace and Code::Blocks project.
Better version of the patch pushed to trunk. More fixes are needed to make this UI even faster.
[r10983]
Related
Commit: [r10983]