google / trax
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 1,849 units with 21,981 lines of code in units (87.5% of code).
    • 2 very complex units (297 lines of code)
    • 9 complex units (1,188 lines of code)
    • 64 medium complex units (3,114 lines of code)
    • 171 simple units (4,441 lines of code)
    • 1,603 very simple units (12,941 lines of code)
1% | 5% | 14% | 20% | 58%
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
py1% | 5% | 14% | 20% | 58%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
trax/data9% | 8% | 12% | 28% | 41%
trax/layers0% | 9% | 14% | 21% | 55%
trax0% | 23% | 0% | 23% | 52%
trax/optimizers0% | 9% | 10% | 19% | 60%
trax/tf_numpy0% | 0% | 21% | 16% | 62%
trax/supervised0% | 0% | 38% | 9% | 51%
trax/models0% | 0% | 10% | 21% | 68%
trax/rl0% | 0% | 6% | 16% | 76%
trax/fastmath0% | 0% | 6% | 20% | 73%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def single_op_to_python_command()
in trax/data/tf_inputs.py
152 73 2
def compute_single_result()
in trax/data/tf_inputs.py
145 66 2
def forward_and_or_backward()
in trax/layers/research/efficient_attention.py
209 41 8
def forward_and_or_backward()
in trax/layers/research/efficient_attention.py
209 41 8
def forward_and_or_backward()
in trax/layers/research/efficient_attention.py
209 41 8
def main()
in trax/predict_drop.py
155 37 1
def CreateMathQAInputs()
in trax/data/tf_inputs.py
125 34 17
def one_step()
in trax/optimizers/trainer.py
86 29 5
def build_from_token_counts()
in trax/data/text_encoder.py
72 27 6
def Parallel()
in trax/data/inputs.py
59 26 5
def forward()
in trax/layers/assert_shape.py
64 26 2
def _ProjectAndSplitHeads()
in trax/layers/research/efficient_attention.py
79 25 9
def forward_and_or_backward()
in trax/layers/research/efficient_attention.py
126 23 7
def beam_search()
in trax/supervised/decoding.py
46 23 9
def pmap()
in trax/tf_numpy/extensions/extensions.py
53 23 3
def pad_to_max_dims()
in trax/data/inputs.py
48 22 3
def attend()
in trax/layers/research/efficient_attention.py
59 22 12
def reverse_and_grad()
in trax/layers/reversible.py
77 22 4
def ConfigurableTerraformer()
in trax/models/research/terraformer.py
211 22 15
def _is_chinese_char()
in trax/data/text_encoder.py
11 20 2