google / riegeli
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 3,603 units with 32,791 lines of code in units (59.6% of code).
    • 15 very long units (2,097 lines of code)
    • 56 long units (4,152 lines of code)
    • 242 medium size units (7,372 lines of code)
    • 475 small units (6,792 lines of code)
    • 2,815 very small units (12,378 lines of code)
6% | 12% | 22% | 20% | 37%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc9% | 18% | 31% | 21% | 19%
h0% | 0% | 4% | 19% | 76%
py0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
riegeli/chunk_encoding30% | 28% | 14% | 12% | 13%
python/riegeli26% | 9% | 22% | 17% | 23%
riegeli/bytes1% | 4% | 27% | 24% | 41%
riegeli/csv11% | 14% | 21% | 15% | 37%
riegeli/base3% | 21% | 20% | 16% | 38%
riegeli/snappy8% | 5% | 11% | 20% | 53%
riegeli/records3% | 22% | 27% | 13% | 31%
riegeli/zstd0% | 39% | 3% | 6% | 51%
riegeli/zlib0% | 20% | 25% | 4% | 49%
riegeli/brotli0% | 23% | 14% | 8% | 54%
riegeli/ordered_varint0% | 48% | 25% | 21% | 4%
riegeli/tensorflow0% | 8% | 35% | 25% | 30%
riegeli/varint0% | 0% | 36% | 54% | 9%
riegeli/lines0% | 0% | 43% | 21% | 35%
riegeli/messages0% | 0% | 17% | 34% | 48%
riegeli/endian0% | 0% | 0% | 44% | 55%
python0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
inline bool TransposeDecoder::Parse()
in riegeli/chunk_encoding/transpose_decoder.cc
304 61 3
inline bool TransposeDecoder::Decode()
in riegeli/chunk_encoding/transpose_decoder.cc
211 57 4
inline bool CsvReaderBase::ReadFields()
in riegeli/csv/csv_reader.cc
152 45 3
inline bool TransposeEncoder::WriteStatesAndData()
in riegeli/chunk_encoding/transpose_encoder.cc
141 32 4
absl::StatusCode ErrnoToStatusCode()
in riegeli/base/errno_mapping.cc
139 85 1
bool FramedSnappyReaderBase::PullBehindScratch()
in riegeli/snappy/framed/framed_snappy_reader.cc
130 26 0
124 31 2
bool PythonReader::ReadInternal()
in python/riegeli/bytes/python_reader.cc
123 25 3
inline bool TransposeEncoder::WriteBuffers()
in riegeli/chunk_encoding/transpose_encoder.cc
118 25 3
inline bool TransposeEncoder::AddMessage()
in riegeli/chunk_encoding/transpose_encoder.cc
117 23 3
This includes seek()
in python/riegeli/records/record_reader.cc
111 13 0
A position of the next record()
in python/riegeli/records/record_writer.cc
111 11 1
std::streampos WriterStreambuf::seekoff()
in riegeli/bytes/writer_ostream.cc
109 30 3
absl::optional RecordReaderBase::Search()
in riegeli/records/record_reader.cc
104 24 1
static int RecordReaderInit()
in python/riegeli/records/record_reader.cc
103 22 3
absl::Status CompressorOptions::FromString()
in riegeli/chunk_encoding/compressor_options.cc
100 7 1
inline bool TransposeEncoder::WriteTransitions()
in riegeli/chunk_encoding/transpose_encoder.cc
98 24 3
inline bool CsvReaderBase::ReadQuoted()
in riegeli/csv/csv_reader.cc
98 30 2
inline void Chain::AppendChain()
in riegeli/base/chain.cc
97 35 2
inline void Chain::PrependChain()
in riegeli/base/chain.cc
97 35 2