Automatic detection of source file affected by header is terribly slow. A complete analysis without the --file filter is 15 minutes. Specifying 40 headers with --file takes more than 1h to analyze. Our compilation database as ~1000 entry.
The bottle neck seem to be get_dependent_sources. As far as I understood, this function is called for each header sequentially and iterate over each entry of the compilation database to compute a dependency lookup table.
We could save the dependency lookup table and parallelize this process.
Easily reproducible with following bash script:
#!/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
touch single_entry.cpp
touch dummy.hpp
touch dummy_2.hpp
echo "Full analysis... ------------------------------------------"
time CodeChecker analyze compile_commands.json -o ./reports
echo "Single source analysis... ------------------------------------------"
time CodeChecker analyze compile_commands.json -o ./reports --file single_entry.cpp
echo "Single header analysis... ------------------------------------------"
time CodeChecker analyze compile_commands.json -o ./reports --file dummy.hpp
echo "Two header analysis... ------------------------------------------"
time CodeChecker analyze compile_commands.json -o ./reports --file dummy.hpp dummy_2.hpp
Environment
❯ CodeChecker version
[INFO 2026-07-07 13:49:00] - CodeChecker analyzer version:
---------------------------------------------------------------
Kind | Version
---------------------------------------------------------------
Base package version | 6.28.2
Package build date | 2026-06-29T08:05
Git commit ID (hash) | 13b2b26718497c13ad9987a5d71d7f2dcb9d270f
Git tag information | 6.28.2
---------------------------------------------------------------
[INFO 2026-07-07 13:49:00] - CodeChecker web version:
------------------------------------------------------------------------------
Kind | Version
------------------------------------------------------------------------------
Base package version | 6.28.2
Package build date | 2026-06-29T08:05
Git commit ID (hash) | 13b2b26718497c13ad9987a5d71d7f2dcb9d270f
Git tag information | 6.28.2
Server supported Thrift API version | 6.71
Client Thrift API version | 6.71
------------------------------------------------------------------------------
❯ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.4 LTS"
Automatic detection of source file affected by header is terribly slow. A complete analysis without the
--filefilter is 15 minutes. Specifying 40 headers with--filetakes more than 1h to analyze. Our compilation database as ~1000 entry.The bottle neck seem to be get_dependent_sources. As far as I understood, this function is called for each header sequentially and iterate over each entry of the compilation database to compute a dependency lookup table.
We could save the dependency lookup table and parallelize this process.
Easily reproducible with following bash script:
Environment