facebookresearch / labgraph
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,106 units with 10,209 lines of code in units (54.0% of code).
    • 4 very long units (665 lines of code)
    • 19 long units (1,276 lines of code)
    • 80 medium size units (2,487 lines of code)
    • 157 small units (2,253 lines of code)
    • 846 very small units (3,528 lines of code)
6% | 12% | 24% | 22% | 34%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp11% | 13% | 28% | 27% | 19%
hpp54% | 0% | 11% | 0% | 33%
h4% | 10% | 25% | 22% | 37%
py0% | 13% | 19% | 18% | 48%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Cthulhu/modules46% | 0% | 9% | 2% | 41%
Cthulhu/src7% | 12% | 28% | 27% | 24%
Cthulhu/include5% | 13% | 31% | 23% | 25%
labgraph/runners0% | 28% | 31% | 13% | 26%
extensions/yaml_support0% | 40% | 15% | 18% | 26%
labgraph/graphs0% | 13% | 30% | 9% | 47%
labgraph/messages0% | 13% | 13% | 15% | 57%
labgraph/cpp0% | 44% | 0% | 31% | 23%
labgraph/loggers0% | 0% | 39% | 27% | 33%
extensions/labgraph_viz0% | 0% | 13% | 33% | 52%
labgraph/_cthulhu0% | 0% | 24% | 12% | 63%
ROOT0% | 0% | 87% | 0% | 12%
extensions/labgraph_protocol0% | 0% | 0% | 28% | 71%
labgraph/websockets0% | 0% | 0% | 32% | 67%
labgraph/util0% | 0% | 0% | 28% | 71%
Cthulhu0% | 0% | 0% | 100% | 0%
win0% | 0% | 0% | 100% | 0%
logging/include0% | 0% | 0% | 26% | 73%
labgraph/events0% | 0% | 0% | 0% | 100%
extensions/psychopy_example0% | 0% | 0% | 0% | 100%
labgraph/zmq_node0% | 0% | 0% | 0% | 100%
labgraph/simulations0% | 0% | 0% | 0% | 100%
labgraph/devices0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void bindings()
in Cthulhu/modules/pythonbindings/core.cpp
289 6 1
inline void priv_open_or_create()
in Cthulhu/src/boost/interprocess/detail/managed_open_or_create_impl_ashmem.hpp
139 38 6
void SubAligner::processManifests()
in Cthulhu/src/SubAligner.cpp
136 28 3
MultiTransformer Context::transform()
in Cthulhu/include/cthulhu/ContextImpl.h
101 13 5
def visit_ClassDef()
in extensions/yaml_support/yaml_support/_parser/lg_units_parser.py
89 30 2
Transformer Context::transform()
in Cthulhu/include/cthulhu/ContextImpl.h
83 11 5
void StreamIPCHybrid::sendSampleIPC()
in Cthulhu/src/StreamRegistryIPCHybrid.cpp
83 14 1
def run()
in labgraph/runners/local_runner.py
81 26 1
void QueueingAligner::align()
in Cthulhu/src/QueueingAligner.cpp
80 14 0
def run()
in labgraph/runners/local_runner.py
76 20 1
def _get_streams()
in labgraph/graphs/group.py
75 11 1
def __init__()
in labgraph/messages/message.py
72 28 3
std::pair VulkanUtil::allocate()
in Cthulhu/src/VulkanUtil.cpp
70 5 2
MultiSubscriber Context::subscribe()
in Cthulhu/include/cthulhu/ContextImpl.h
63 9 4
void SubAligner::sampleCallback()
in Cthulhu/src/SubAligner.cpp
61 9 2
58 10 2
def _start_processes()
in labgraph/runners/parallel_runner.py
58 11 1
def _wait_for_startup_phase()
in labgraph/runners/process_manager.py
57 24 2
int Aligner::align()
in Cthulhu/src/SubAlignerImpl.cpp
55 11 1
MultiSubscriber Context::subscribe()
in Cthulhu/include/cthulhu/ContextImpl.h
54 7 4