facebookresearch / faiss
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 2,306 units with 33,434 lines of code in units (46.0% of code).
    • 0 very complex units (0 lines of code)
    • 9 complex units (1,457 lines of code)
    • 108 medium complex units (7,920 lines of code)
    • 206 simple units (7,148 lines of code)
    • 1,983 very simple units (16,909 lines of code)
0% | 4% | 23% | 21% | 50%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
cpp0% | 4% | 26% | 22% | 46%
py0% | 5% | 21% | 18% | 54%
h0% | 0% | 2% | 10% | 87%
c0% | 0% | 0% | 95% | 4%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
faiss0% | 8% | 32% | 21% | 38%
faiss/impl0% | 3% | 21% | 28% | 46%
contrib0% | 17% | 20% | 15% | 46%
faiss/gpu0% | 6% | 27% | 19% | 46%
faiss/utils0% | 0% | 16% | 16% | 67%
faiss/python0% | 0% | 34% | 8% | 57%
tutorial/cpp0% | 0% | 83% | 16% | 0%
benchs/bench_all_ivf0% | 0% | 41% | 28% | 30%
faiss/invlists0% | 0% | 15% | 22% | 62%
benchs/distributed_ondisk0% | 0% | 10% | 15% | 73%
benchs0% | 0% | 6% | 31% | 62%
benchs/link_and_code0% | 0% | 0% | 38% | 61%
c_api/gpu0% | 0% | 0% | 21% | 78%
c_api0% | 0% | 0% | 6% | 93%
c_api/impl0% | 0% | 0% | 0% | 100%
c_api/utils0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
void Clustering::train_encoded()
in faiss/Clustering.cpp
227 42 5
def handle_torch_Index()
in contrib/torch_utils.py
247 40 1
void write_index()
in faiss/impl/index_write.cpp
249 38 2
203 38 10
void PCAMatrix::train()
in faiss/VectorTransform.cpp
136 31 2
117 29 9
97 27 3
103 26 5
std::vector packInterleaved()
in faiss/gpu/impl/InterleavedCodes.cpp
78 26 4
void hnsw_add_vertices()
in faiss/IndexHNSW.cpp
105 25 6
void ParameterSpace::explore()
in faiss/AutoTune.cpp
117 25 5
void ResidualQuantizer::train()
in faiss/impl/ResidualQuantizer.cpp
150 24 2
void IndexIVFPQFastScan::search_implem_12()
in faiss/IndexIVFPQFastScan.cpp
148 24 8
void train_Uniform()
in faiss/impl/ScalarQuantizer.cpp
102 23 6
145 23 8
def parse_result_file()
in benchs/bench_all_ivf/parse_bench_all_ivf.py
63 23 1
93 22 3
void quantize_LUT_and_bias()
in faiss/utils/quantize_lut.cpp
135 22 11
std::unique_ptr index_factory_sub()
in faiss/index_factory.cpp
146 21 3
def get_code_size()
in contrib/factory_tools.py
49 20 2