tensorflow / swift-apis
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 1,816 units with 17,739 lines of code in units (19.4% of code).
    • 4 very long units (486 lines of code)
    • 27 long units (1,778 lines of code)
    • 155 medium size units (4,642 lines of code)
    • 323 small units (4,594 lines of code)
    • 1,307 very small units (6,239 lines of code)
2% | 10% | 26% | 25% | 35%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py23% | 19% | 24% | 18% | 13%
cpp1% | 9% | 33% | 30% | 24%
cc2% | 10% | 26% | 27% | 32%
swift0% | 13% | 25% | 27% | 34%
h0% | 0% | 6% | 18% | 75%
inc0% | 0% | 0% | 5% | 94%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Sources/x104% | 10% | 29% | 27% | 27%
Sources/TensorFlow0% | 10% | 32% | 25% | 32%
Sources/Tensor0% | 91% | 0% | 6% | 2%
Sources/CX100% | 2% | 3% | 18% | 74%
Utilities0% | 0% | 45% | 37% | 17%
Utilities/ReferenceImplementations0% | 0% | 0% | 88% | 11%
Sources/CX10Modules0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def node_type_define()
in Sources/x10/swift_bindings/generate_ops.py
135 47 1
def c_function_define()
in Sources/x10/swift_bindings/generate_ops.py
134 57 1
NmsResult BuildNms()
in Sources/x10/xla_tensor/nms_op.cpp
114 1 5
std::map XrtComputationClient::GetMetrics()
in Sources/x10/xla_client/xrt_computation_client.cc
103 13 0
func sha512()
in Sources/Tensor/TensorUtilities.swift
100 7 0
std::vector OpByOpExecutor::BuildOps()
in Sources/x10/xla_tensor/op_by_op_executor.cpp
98 12 3
init()
in Sources/TensorFlow/Core/Runtime.swift
82 11 0
def main()
in Sources/TensorFlow/Bindings/generate_wrappers.py
81 16 1
xla::XlaOp ComputeMaxPoolIndices()
in Sources/x10/xla_tensor/pooling.cpp
78 2 5
func sha1()
in Sources/Tensor/TensorUtilities.swift
78 10 0
std::vector XrtComputationClient::Compile()
in Sources/x10/xla_client/xrt_computation_client.cc
75 5 3
def canonicalize_op()
in Sources/x10/swift_bindings/generate_ops.py
73 24 1
XlaOpVector Lower()
in Sources/CX10/functional_while.cc
73 10 1
std::vector XrtComputationClient::ExecuteChainedXrt()
in Sources/x10/xla_client/xrt_computation_client.cc
72 9 2
def swift_wrapper_define()
in Sources/x10/swift_bindings/generate_ops.py
66 22 1
func updateOutputShapes()
in Sources/TensorFlow/Core/LazyTensorShapeInference.swift
62 9 0
NodePtr ARange()
in Sources/x10/xla_tensor/ops/ops.cpp
62 15 4
xla::XlaOp XlaDenseScatter()
in Sources/x10/xla_tensor/xla_lower_util.cpp
62 11 5
void TensorToBufferSType()
in Sources/x10/xla_tensor/tensor_util.cpp
60 14 5
void XrtComputationClient::InitializeDevices()
in Sources/x10/xla_client/xrt_computation_client.cc
60 13 1