neo-ai / treelite
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 429 units with 5,162 lines of code in units (55.1% of code).
    • 1 very complex units (255 lines of code)
    • 0 complex units (0 lines of code)
    • 16 medium complex units (947 lines of code)
    • 39 simple units (1,112 lines of code)
    • 373 very simple units (2,848 lines of code)
4% | 0% | 18% | 21% | 55%
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
cc9% | 0% | 21% | 19% | 49%
py0% | 0% | 28% | 20% | 50%
h0% | 0% | 0% | 19% | 80%
java0% | 0% | 0% | 47% | 52%
cpp0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
src/frontend29% | 0% | 40% | 0% | 30%
python/treelite0% | 0% | 22% | 23% | 54%
src/compiler0% | 0% | 19% | 33% | 47%
runtime/native0% | 0% | 21% | 15% | 62%
runtime/java0% | 0% | 0% | 42% | 57%
src/c_api0% | 0% | 0% | 16% | 83%
src/common0% | 0% | 0% | 50% | 49%
include/treelite0% | 0% | 0% | 14% | 85%
src0% | 0% | 0% | 40% | 59%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
inline treelite::Model ParseStream()
in src/frontend/lightgbm.cc
255 53 1
def predict_instance()
in runtime/native/python/treelite_runtime/predictor.py
50 20 4
def _varsall_bat_path()
in python/treelite/contrib/msvc.py
49 20 0
inline treelite::Model ParseStream()
in src/frontend/xgboost.cc
102 17 1
def generate_makefile()
in python/treelite/contrib/__init__.py
50 17 4
def find_lib_path()
in runtime/native/python/treelite_runtime/libpath.py
35 16 2
def create_shared()
in python/treelite/contrib/__init__.py
45 16 5
def _create_shared_base()
in python/treelite/contrib/util.py
60 16 4
def find_lib_path()
in python/treelite/libpath.py
35 16 2
bool fold_code()
in src/compiler/ast/fold_code.cc
54 15 3
Model LoadProtobufModel()
in src/frontend/protobuf.cc
125 14 1
def from_npy2d()
in runtime/native/python/treelite_runtime/predictor.py
30 13 5
void ExportProtobufModel()
in src/frontend/protobuf.cc
88 12 2
CompiledModel Compile()
in src/compiler/failsafe.cc
91 12 1
inline std::vector LoadText()
in src/frontend/lightgbm.cc
32 11 1
void HandleQNode()
in src/compiler/ast_native.cc
60 11 3
def from_csr()
in runtime/native/python/treelite_runtime/predictor.py
41 11 4
public static String createTempFileFromResource()
in runtime/java/treelite4j/src/main/java/ml/dmlc/treelite4j/NativeLibLoader.java
39 10 1
def predict()
in runtime/native/python/treelite_runtime/predictor.py
26 10 4
def import_model()
in python/treelite/gallery/sklearn/__init__.py
28 10 1