microsoft / envoy
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 4,993 units with 41,686 lines of code in units (41.7% of code).
    • 15 very long units (2,042 lines of code)
    • 60 long units (3,935 lines of code)
    • 403 medium size units (12,141 lines of code)
    • 689 small units (9,861 lines of code)
    • 3,826 very small units (13,707 lines of code)
4% | 9% | 29% | 23% | 32%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc5% | 10% | 31% | 25% | 25%
py0% | 4% | 40% | 20% | 34%
h0% | 1% | 4% | 8% | 85%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
source/common6% | 10% | 28% | 24% | 29%
source/extensions3% | 9% | 29% | 23% | 35%
source/server3% | 8% | 31% | 21% | 34%
tools0% | 8% | 27% | 25% | 38%
tools/protodoc0% | 0% | 36% | 27% | 35%
tools/envoy_collect0% | 0% | 97% | 0% | 2%
restarter0% | 0% | 53% | 10% | 36%
tools/deprecate_version0% | 0% | 71% | 20% | 8%
api/tools0% | 0% | 48% | 17% | 34%
source/exe0% | 0% | 17% | 50% | 32%
bazel0% | 0% | 72% | 0% | 27%
include/envoy0% | 0% | 0% | 7% | 92%
configs0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
const std::string Json::Schema::CLUSTER_SCHEMA()
in source/common/json/config_schemas.cc
214 1 0
InstanceConstSharedPtr peerAddressFromFd()
in source/common/network/address_impl.cc
212 23 1
void DecoderImpl::parseSlice()
in source/extensions/filters/network/redis_proxy/codec_impl.cc
181 35 1
void HttpGrpcAccessLog::log()
in source/extensions/access_loggers/http_grpc/grpc_access_log_impl.cc
168 41 4
147 1 0
const std::string Json::Schema::ACCESS_LOG_SCHEMA()
in source/common/json/config_schemas.cc
124 1 0
const std::string Json::Schema::TOP_LEVEL_CONFIG_SCHEMA()
in source/common/json/config_schemas.cc
123 1 0
void RdsJson::translateRoute()
in source/common/config/rds_json.cc
122 30 2
void CdsJson::translateCluster()
in source/common/config/cds_json.cc
112 21 4
110 1 0
109 1 0
void InstanceImpl::initialize()
in source/server/server.cc
106 8 3
void ConnectionManagerImpl::ActiveStream::decodeHeaders()
in source/common/http/conn_manager_impl.cc
105 30 2
void DocumentImpl::fromBuffer()
in source/extensions/filters/network/mongo_proxy/bson_impl.cc
105 18 1
104 28 7
Http::FilterHeadersStatus Filter::decodeHeaders()
in source/common/router/router.cc
98 12 2
bool BaseDynamicClusterImpl::updateDynamicHostList()
in source/common/upstream/upstream_impl.cc
98 26 6
bool Filter::readProxyHeader()
in source/extensions/filters/listener/proxy_protocol/proxy_protocol.cc
94 22 1
void ConnectionManagerImpl::ActiveStream::encodeHeaders()
in source/common/http/conn_manager_impl.cc
93 33 3
bool ListenerManagerImpl::addOrUpdateListener()
in source/server/listener_manager_impl.cc
90 20 3