tensorflow / quantum
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 375 units with 8,786 lines of code in units (77.6% of code).
    • 8 very long units (885 lines of code)
    • 45 long units (3,064 lines of code)
    • 91 medium size units (2,937 lines of code)
    • 77 small units (1,183 lines of code)
    • 154 very small units (717 lines of code)
10% | 34% | 33% | 13% | 8%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc18% | 44% | 25% | 7% | 3%
py0% | 22% | 41% | 21% | 13%
h0% | 31% | 50% | 5% | 12%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tensorflow_quantum/core/ops16% | 48% | 26% | 4% | 4%
tensorflow_quantum/core/src13% | 21% | 37% | 19% | 8%
tensorflow_quantum/datasets0% | 86% | 7% | 4% | 1%
tensorflow_quantum/python/layers0% | 36% | 37% | 17% | 9%
tensorflow_quantum/python/optimizers0% | 77% | 0% | 15% | 7%
tensorflow_quantum/python/differentiators0% | 23% | 52% | 14% | 10%
tensorflow_quantum/python0% | 11% | 47% | 28% | 13%
tensorflow_quantum/core/serialize0% | 0% | 44% | 34% | 21%
benchmarks/scripts0% | 0% | 64% | 16% | 19%
scripts0% | 0% | 100% | 0% | 0%
benchmarks/scripts/models0% | 0% | 100% | 0% | 0%
release0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void CreateGradientCircuit()
in tensorflow_quantum/core/src/adj_util.cc
118 37 4
void Compute()
in tensorflow_quantum/core/ops/math_ops/tfq_inner_product_grad.cc
117 7 1
void ComputeSmall()
in tensorflow_quantum/core/ops/noise/tfq_noisy_sampled_expectation.cc
112 14 7
void ComputeSmall()
in tensorflow_quantum/core/ops/noise/tfq_noisy_expectation.cc
110 14 7
void Compute()
in tensorflow_quantum/core/ops/tfq_ps_symbol_replace_op.cc
109 11 1
void ComputeSmall()
in tensorflow_quantum/core/ops/math_ops/tfq_inner_product_grad.cc
107 12 11
Status ResolveQubitIds()
in tensorflow_quantum/core/src/program_resolution.cc
107 22 3
void Compute()
in tensorflow_quantum/core/ops/tfq_ps_decompose_op.cc
105 25 1
def tfi_rectangular()
in tensorflow_quantum/datasets/spin_system.py
100 26 3
void Compute()
in tensorflow_quantum/core/ops/tfq_ps_weights_from_symbols_op.cc
97 15 1
void ComputeSmall()
in tensorflow_quantum/core/ops/noise/tfq_noisy_samples.cc
92 11 6
def xxz_chain()
in tensorflow_quantum/datasets/spin_system.py
85 22 3
void ComputeLarge()
in tensorflow_quantum/core/ops/noise/tfq_noisy_sampled_expectation.cc
83 14 6
void Compute()
in tensorflow_quantum/core/ops/tfq_calculate_unitary_op.cc
82 9 1
void Compute()
in tensorflow_quantum/core/ops/math_ops/tfq_inner_product.cc
81 7 1
def generate_differentiable_op()
in tensorflow_quantum/python/differentiators/differentiator.py
81 11 4
void ComputeLarge()
in tensorflow_quantum/core/ops/noise/tfq_noisy_expectation.cc
80 14 6
def _get_cirq_samples()
in tensorflow_quantum/core/ops/cirq_ops.py
80 16 1
void Compute()
in tensorflow_quantum/core/ops/tfq_adj_grad_op.cc
80 5 1
Status ResolveQubitIds()
in tensorflow_quantum/core/src/program_resolution.cc
80 20 4