Nothing Special   »   [go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve perf for compile dbs in large projects #2161

Merged
merged 1 commit into from
Jan 8, 2019

Conversation

guill
Copy link
Contributor
@guill guill commented Dec 23, 2018

When using a compilation database (compile_commands.json) in very large
projects, significant delays would occur when changing files --
particularly those that happened to be far down the db. Rather than
iterating over the whole list every time, we now build up a lookup table
based on the tail of the filename (and tail of the directory for
widening searches) and iterate over the much smaller list of compile
commands for files with the given name.

Test metrics (from compile_database_perf/test.sh) show a 90% performance
improvement -- from 25 seconds to 2.5 seconds per run.

Because behavior should be functionally identical to the old version, I didn't have a whole lot of tests to add. I added one test for an old behavior that wasn't tested -- falling back to files in the same directory if we can't find an exact match.

As far as I can tell, vader doesn't have any sort of support for performance profiling. Instead, I added a bash script to verify the performance improvement. Because this particular issue only becomes noticeable in large projects (and I didn't think people would be happy with me checking in a couple hundred tiny test files), the bash script generates all required files for testing.

@w0rp
Copy link
Member
w0rp commented Jan 3, 2019

Looks pretty good. Have a look at the conflicts now I've merged something else.

@guill guill force-pushed the compile_database_perf branch 2 times, most recently from a018c9f to 4c3eeb5 Compare January 6, 2019 08:34
When using a compilation database (compile_commands.json) in very large
projects, significant delays would occur when changing files --
particularly those that happened to be far down the db. Rather than
iterating over the whole list every time, we now build up a lookup table
based on the tail of the filename (and tail of the directory for
widening searches) and iterate over the much smaller list of compile
commands for files with the given name.

Test metrics (from compile_database_perf/test.sh) show a 90% performance
improvement -- from 25 seconds to 2.5 seconds per run.
@guill
Copy link
Contributor Author
guill commented Jan 8, 2019

I've rebased the changes and resolved conflicts. Everything seems to be working correctly.

@w0rp w0rp merged commit 1d7acad into dense-analysis:master Jan 8, 2019
@w0rp
Copy link
Member
w0rp commented Jan 8, 2019

Cheers! 🍻

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