firebase / grpc-SwiftPM
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 12,649 units with 113,366 lines of code in units (43.3% of code).
    • 43 very long units (7,206 lines of code)
    • 166 long units (11,284 lines of code)
    • 1,018 medium size units (30,792 lines of code)
    • 1,786 small units (26,183 lines of code)
    • 9,636 very small units (37,901 lines of code)
6% | 9% | 27% | 23% | 33%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc9% | 14% | 31% | 23% | 21%
py8% | 9% | 26% | 19% | 36%
cs3% | 1% | 24% | 27% | 43%
c0% | 13% | 32% | 22% | 31%
h0% | <1% | 10% | 20% | 68%
rb0% | 1% | 32% | 27% | 38%
go0% | 0% | 45% | 29% | 24%
pxi0% | 0% | 15% | 28% | 55%
php0% | 0% | 25% | 42% | 32%
m0% | 0% | 0% | 58% | 41%
pyx0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src6% | 10% | 27% | 23% | 33%
tools14% | 14% | 36% | 16% | 17%
include0% | 0% | 16% | 30% | 52%
spm-cpp-include0% | 0% | 17% | 30% | 52%
ROOT0% | 0% | 77% | 0% | 22%
spm-core-include0% | 0% | 0% | 34% | 65%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def massage_qps_stats()
in tools/run_tests/performance/massage_qps_stats.py
490 30 1
JsonReader::Status JsonReader::Run()
in src/core/lib/json/json_reader.cc
484 218 0
static grpc_call_error call_start_batch()
in src/core/lib/surface/call.cc
374 60 5
static enum e_op_result execute_stream_op()
in src/core/ext/transport/cronet/transport/cronet_transport.cc
356 58 1
def scenarios()
in tools/run_tests/performance/scenario_config.py
330 11 1
static void perform_stream_op_locked()
in src/core/ext/transport/chttp2/transport/chttp2_transport.cc
270 40 2
void op_state_machine_locked()
in src/core/ext/transport/inproc/inproc_transport.cc
233 58 2
void PrintSourceClientMethod()
in src/compiler/cpp_generator.cc
212 9 3
void PrintHeaderService()
in src/compiler/cpp_generator.cc
201 36 3
void PrintHeaderClientMethodInterfaces()
in src/compiler/cpp_generator.cc
195 18 4
void PrintHeaderClientMethod()
in src/compiler/cpp_generator.cc
185 18 4
183 35 10
std::unique_ptr ServerBuilder::BuildAndStart()
in src/cpp/server/server_builder.cc
155 42 0
static bool read_channel_args()
in src/core/ext/transport/chttp2/transport/chttp2_transport.cc
152 29 3
void perform_stream_op()
in src/core/ext/transport/inproc/inproc_transport.cc
148 59 3
static void close_from_api()
in src/core/ext/transport/chttp2/transport/chttp2_transport.cc
142 5 3
static bool op_can_be_run()
in src/core/ext/transport/cronet/transport/cronet_transport.cc
142 73 4
virtual bool Generate()
in src/compiler/objective_c_plugin.cc
139 22 4
void GrpcLb::BalancerCallState::OnBalancerMessageReceivedLocked()
in src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
133 23 2
130 27 10