facebookresearch / CompilerGym
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 796 units with 7,329 lines of code in units (37.2% of code).
    • 1 very complex units (389 lines of code)
    • 2 complex units (337 lines of code)
    • 14 medium complex units (756 lines of code)
    • 43 simple units (1,235 lines of code)
    • 736 very simple units (4,612 lines of code)
5% | 4% | 10% | 16% | 62%
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
py6% | 0% | 12% | 16% | 63%
cc0% | 25% | 3% | 20% | 50%
h0% | 0% | 0% | 12% | 87%
js0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
compiler_gym/envs9% | 8% | 12% | 16% | 52%
compiler_gym/views0% | 0% | 51% | 4% | 43%
compiler_gym/leaderboard0% | 0% | 67% | 26% | 6%
compiler_gym0% | 0% | 14% | 8% | 77%
leaderboard/llvm_instcount0% | 0% | 46% | 45% | 8%
compiler_gym/spaces0% | 0% | 9% | 0% | 90%
compiler_gym/service0% | 0% | 0% | 28% | 71%
compiler_gym/util0% | 0% | 0% | 14% | 85%
www0% | 0% | 0% | 56% | 43%
compiler_gym/datasets0% | 0% | 0% | 7% | 92%
compiler_gym/wrappers0% | 0% | 0% | 7% | 92%
www/frontends0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def make_gcc_compilation_session()
in compiler_gym/envs/gcc/service/gcc_service.py
389 70 1
cc
Status setObservation()
in compiler_gym/envs/llvm/service/Observation.cc
178 33 4
cc
std::vector getLlvmObservationSpaceList()
in compiler_gym/envs/llvm/service/ObservationSpaces.cc
159 28 0
def validator_cb()
in compiler_gym/envs/llvm/datasets/cbench.py
92 21 1
def apply_action()
in compiler_gym/envs/loop_tool/service/loop_tool_compilation_session.py
32 15 2
cc
Status LlvmSession::handleSessionParameter()
in compiler_gym/envs/llvm/service/LlvmSession.cc
50 15 3
def _gcc_parse_optimize()
in compiler_gym/envs/gcc/gcc.py
82 15 1
def _gcc_parse_params()
in compiler_gym/envs/gcc/gcc.py
72 15 1
def _fix_options()
in compiler_gym/envs/gcc/gcc.py
32 15 1
def eval_llvm_instcount_policy()
in compiler_gym/leaderboard/llvm_instcount.py
66 14 1
def validate()
in compiler_gym/envs/compiler_env.py
82 14 2
def from_proto()
in compiler_gym/views/observation_space_spec.py
108 14 3
def error_details()
in compiler_gym/validation_result.py
23 13 1
def e_greedy_search()
in leaderboard/llvm_instcount/e_greedy/e_greedy.py
42 12 1
def contains()
in compiler_gym/spaces/sequence.py
15 12 2
def get_compiler_includes()
in compiler_gym/envs/llvm/llvm_benchmark.py
40 12 1
def join()
in compiler_gym/validation_result.py
20 11 2
def proto_to_action_space()
in compiler_gym/service/proto/py_converters.py
36 10 1
def reset()
in compiler_gym/envs/llvm/llvm_env.py
20 10 3
cc
Status getTextSizeInBytes()
in compiler_gym/envs/llvm/service/Cost.cc
90 10 4