google / shaka-player
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 2,191 units with 34,681 lines of code in units (83.5% of code).
    • 26 very long units (3,508 lines of code)
    • 100 long units (6,699 lines of code)
    • 360 medium size units (11,128 lines of code)
    • 478 small units (6,920 lines of code)
    • 1,227 very small units (6,426 lines of code)
10% | 19% | 32% | 19% | 18%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js10% | 19% | 31% | 19% | 18%
py12% | 7% | 39% | 23% | 17%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
lib/text27% | 23% | 25% | 15% | 8%
lib18% | 22% | 30% | 17% | 10%
lib/dash25% | 31% | 31% | 8% | 3%
lib/util8% | 13% | 31% | 22% | 24%
lib/hls20% | 23% | 33% | 13% | 8%
build9% | 10% | 36% | 25% | 16%
lib/net20% | 29% | 28% | 10% | 11%
lib/media2% | 23% | 32% | 21% | 20%
lib/ads13% | 10% | 16% | 26% | 33%
lib/cast7% | 14% | 43% | 17% | 17%
ui0% | 22% | 35% | 18% | 23%
lib/offline0% | 14% | 39% | 24% | 21%
lib/polyfill0% | 15% | 27% | 32% | 24%
lib/cea0% | 18% | 30% | 19% | 31%
lib/abr0% | 0% | 46% | 12% | 41%
lib/routing0% | 0% | 46% | 41% | 11%
externs/shaka0% | 0% | 65% | 22% | 12%
lib/deprecate0% | 0% | 0% | 34% | 65%
externs0% | 0% | 0% | 0% | 100%
ui/externs0% | 0% | 0% | 0% | 100%
lib/debug0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in build/test.py
219 1 2
parseAdaptationSet_()
in lib/dash/dash_parser.js
206 55 2
async processManifest_()
in lib/dash/dash_parser.js
185 42 2
static createDefault()
in lib/util/player_configuration.js
172 7 0
onSrcEquals_()
in lib/player.js
153 18 2
static addStyle_()
in lib/text/ttml_text_parser.js
150 41 7
send_()
in lib/net/networking_engine.js
149 30 6
static parseCue_()
in lib/text/ttml_text_parser.js
147 41 11
setCaptionStyles_()
in lib/text/ui_text_displayer.js
141 36 4
async createStreamInfo_()
in lib/hls/hls_parser.js
140 20 12
static getDecodingConfigs_()
in lib/util/stream_utils.js
140 41 3
async parseManifest_()
in lib/hls/hls_parser.js
125 20 1
constructor()
in lib/player.js
124 4 2
addImaEventListeners_()
in lib/ads/client_side_ad_manager.js
123 1 0
async fetchAndAppend_()
in lib/media/streaming_engine.js
123 24 3
async onLoad_()
in lib/player.js
123 15 2
static generateSegmentIndexFromDuration_()
in lib/dash/segment_template.js
122 12 5
parseMedia()
in lib/text/mp4_vtt_parser.js
117 18 2
async combinePeriods()
in lib/util/periods.js
117 22 2
addTextTrack()
in lib/player.js
115 19 7