tensorflow / lingvo
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 5,983 units with 88,898 lines of code in units (86.7% of code).
    • 1 very complex units (183 lines of code)
    • 25 complex units (3,037 lines of code)
    • 212 medium complex units (13,178 lines of code)
    • 512 simple units (17,457 lines of code)
    • 5,233 very simple units (55,043 lines of code)
<1% | 3% | 14% | 19% | 61%
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
py<1% | 3% | 14% | 18% | 63%
cc0% | 9% | 16% | 32% | 42%
h0% | 0% | 23% | 23% | 52%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
lingvo/core<1% | 3% | 14% | 18% | 62%
lingvo0% | 11% | 32% | 22% | 33%
lingvo/core/ops0% | 7% | 16% | 29% | 47%
lingvo/jax0% | 5% | 18% | 16% | 59%
lingvo/tasks/car0% | 1% | 14% | 17% | 65%
lingvo/tasks/mt0% | 2% | 16% | 19% | 61%
lingvo/jax/layers0% | 1% | 12% | 25% | 60%
lingvo/tasks/asr0% | 0% | 16% | 28% | 54%
lingvo/tasks/lm0% | 0% | 6% | 19% | 74%
lingvo/tools0% | 0% | 12% | 12% | 74%
lingvo/tasks/punctuator0% | 0% | 30% | 4% | 65%
lingvo/tasks/milan0% | 0% | 4% | 10% | 85%
lingvo/jax/tasks0% | 0% | 0% | 7% | 92%
lingvo/tasks/image0% | 0% | 0% | 12% | 87%
lingvo/core/steps0% | 0% | 0% | 10% | 89%
docker0% | 0% | 0% | 22% | 78%
pip_package0% | 0% | 0% | 0% | 100%
lingvo/jax/pip_package0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def Export()
in lingvo/core/inference_graph_exporter.py
183 58 9
def FPropFn()
in lingvo/core/gshard_layers.py
277 50 7
def flat_beam_search()
in lingvo/core/flat_beam_search_helper.py
241 42 16
Status ComputeTopK()
in lingvo/core/ops/beam_search_step_op_kernels.cc
203 41 22
def __init__()
in lingvo/core/recurrent.py
183 38 13
def Top2GatingOnLogits()
in lingvo/core/gshard_layers.py
192 34 14
def __init__()
in lingvo/core/base_model.py
81 33 2
214 32 8
PSUtils::Result PSUtils::DoSampling()
in lingvo/tasks/car/ops/ps_utils.cc
152 31 3
def _RunLoop()
in lingvo/base_runner.py
72 30 4
Status Merge()
in lingvo/core/ops/generic_input_op_kernels.cc
127 30 3
def ToText()
in lingvo/core/hyperparams.py
49 30 3
def UpdateProgramSchedule()
in lingvo/core/program.py
73 30 8
def __init__()
in lingvo/executor.py
178 29 5
def __init__()
in lingvo/jax/layers/transformers.py
79 28 2
def Visit()
in lingvo/core/hyperparams.py
54 28 10
def ComputationShape()
in lingvo/core/py_utils.py
62 28 2
def _BodyFPropInternal()
in lingvo/core/gshard_layers.py
141 27 8
def ToProto()
in lingvo/core/hyperparams.py
60 27 1
def FProp()
in lingvo/core/gpipe.py
144 27 3