[perf] Improve analyze file filter for header - #4951
Conversation
e5454a3 to
52b6abd
Compare
bruntib
left a comment
There was a problem hiding this comment.
Hi @gzzi,
Thank you for the path, this is a really nice catch and a great improvement!
However, I have some concerns related to the solution design. It doesn't seem intuitive for a library to provide a "dependencies" as a parameter because it is supposed to be the result of the function, more or less. I mean, only an extra filtering happens, based on the file filter.
Couldn't get_dependent_sources() be redesigned in a way that header_path becomes header_paths: Optional[List[str]]. This way, this function could be called only once from get_affected_file_paths() instead of calling it many times in a loop.
What do you think?
52b6abd to
e9724ed
Compare
8172d77 to
594bfa2
Compare
|
Hello @bruntib, Agree, I tried to keep my change on Note that now the order of |
|
Hi @gzzi, Thank you for the fixes. I have just two small comments:
Also, one more question. I understand the goal of the development, and it is really useful in case of big projects. However, if I Thank you again this development. Please, consider applying these two minor fixes, otherwise we can merge it. |
594bfa2 to
fadc926
Compare
|
Hello @bruntib, Requested changes have been applied.
The path are absolute on the #!/bin/bash
function generate_db {
echo "Generating database..."
echo "[" > compile_commands.json
for _ in {1..1000}; do
echo "{\"directory\": \"$(pwd)\", \"command\": \"g++ dummy.cpp -c -o dummy.o\", \"file\": \"dummy.cpp\", \"output\": \"dummy.o\"}," >> compile_commands.json
done
echo "{\"directory\": \"$(pwd)\", \"command\": \"g++ single_entry.cpp -c -o dummy.o\", \"file\": \"single_entry.cpp\", \"output\": \"dummy.o\"}" >> compile_commands.json
echo "]" >> compile_commands.json
}
generate_db
touch dummy.cpp
echo "#include \"dummy.hpp\"" > single_entry.cpp
touch dummy.hpp
touch dummy_2.hpp
echo "Relative path ------------------------------------------"
time CodeChecker analyze compile_commands.json -o ./reports --file dummy.hpp
echo "Absolute path ------------------------------------------"
time CodeChecker analyze compile_commands.json -o ./reports --file $(pwd)/dummy.hpp
On our CI, when an analysis of a pull request is made, we check only files that was modified compared to main branch fork point. This save us quite a lot of time. The full analysis are made only nightly. |
|
Hi @gzzi, I see now. Thank you for the explanation and thank you for the patch! |
In this PR:
Close #4949