Css Performance wh J Ron GHub’s
Tnk y f comg
Th talk abt Pfmce probms GHub How
ce ft C HTML C/HTML ols GHub
brief about me J Ron’s
Hello, I’m @JonRohan photo by Zachary Kaplan
I’m a Dign-gr
B.S. Comput Sce
8 yrs C
I’m a GHu
photo by @janaboruta
Performance woes GHub’s
Slow Scary GitHub
Slow Scary GitHub
I’m talkg abt diff pag
“a mium size diff”
~9,0 l acrs a fis
~80% pagoad calcung
28.16s calcute sty!
Wt caus sty calcung?
Mipung DOM
Hidg usg . display: none; visibility: hidden;
C Animns
Us Acs
A bad ...
may cause brows h
Something went wrong while displaying this keynote To continue, press
Reload or go to another talk.
trouble css GHub’s
no uecsy tag iifis
#navigation, .menu { margin-‐left: 0; } 1
2 3 4 ul ul
no crs
html div tr td { font-‐weight: bold; } 1
2 3 html div tr td
no univsal secrs
* { display: block; } 1 2 3
no unqualifi secrs
[class^="mini-‐icon-‐"] { display: block; } 1 2 3
no cg
r imptce (wn y do c)
webk bug?
{
width: 30px; } 1 2 3 .foo.bar Iex m_classRules u key .foo
{
width: 30px; } 1 2 3 .bar.foo Iex m_classRules u key .bar
{
width: 30px; } 1 2 3 .bar#foo Iex m_classRules
{
width: 30px; } 1 2 3 #foo.bar Iex m_idRules
June July August September October November 4700 4875 5050 5225
5400 numb c secrs
June July August September October November 4700 4875 5050 5225
5400 numb c secrs
It’s a ve
C + HTML
HTML overload GHub’s
how much html do we ve?
a typical diff le
<tr> <td class="line_number"><a id="L1L5" href="#L1L5">5</a></td> <td class="line_number"><a id="L1R7"
href="#L1R7">7</a></td> <td width="100%"> <div class="add-‐bubble"></div> <pre><div>+ this is a line in the diff</div></pre> </td> </tr> 1 2 3 4 5 6 7 8
avage diffs ve ~9,0 l
> $('#files_bucket *').length
> $('#files_bucket *').length 48917
but ’s not a probm
15ms pagoad
wt c we do?
duce am mcd html
solutions GHub’s
k simp
move uecsy html
Ki wh fi
<tr> <td class="line_number"><a id="L1L5" href="#L1L5">5</a></td> <td class="line_number"><a id="L1R7"
href="#L1R7">7</a></td> <td width="100%"> <div class="add-‐bubble"></div> <pre><div>+ this is a line in the diff</div></pre> </td> </tr> 1 2 3 4 5 6 7 8
<tr> <td class="line_number"><a id="L1L5" href="#L1L5">5</a></td> <td class="line_number"><a id="L1R7"
href="#L1R7">7</a></td> <td width="100%"> <div class="add-‐bubble"></div> <pre><div>+ this is a line in the diff</div></pre> </td> </tr> 1 2 3 4 5 6 7 8 <pre>+ this is a line in the diff</pre>
6,387 uecsy divs
move <a> f le numbs
<tr> <td class="line_number"><a id="L1L5" href="#L1L5">5</a></td> <td class="line_number"><a id="L1R7"
href="#L1R7">7</a></td> <td width="100%"> <div class="add-‐bubble"></div> <pre>+ this is a line in the diff</pre> </td> </tr> 1 2 3 4 5 6 7 8
<tr> <td class="line_number"><a id="L1L5" href="#L1L5">5</a></td> <td class="line_number"><a id="L1R7"
href="#L1R7">7</a></td> <td width="100%"> <div class="add-‐bubble"></div> <pre>+ this is a line in the diff</pre> </td> </tr> 1 2 3 4 5 6 7 8 <td id="L1L5" class="line_number linkable-‐line-‐numbers">5</td> <td id="L1R7" class="line_number linkable-‐line-‐numbers">7</td>
Improv Rr spd by 37%
<b>S! <b>S!
<tr> <td id="L1L5" class="line_number linkable-‐line-‐numbers">5</td> <td id="L1R7" class="line_number
linkable-‐line-‐numbers">7</td> <td width="100%"> <div class="add-‐bubble"></div> <pre>+ this is a line in the diff</pre> </td> </tr> 1 2 3 4 5 6 7 8
<tr> <td id="L1L5" class="line_number linkable-‐line-‐numbers">5</td> <td id="L1R7" class="line_number
linkable-‐line-‐numbers">7</td> <td width="100%"> <div class="add-‐bubble"></div> <pre>+ this is a line in the diff</pre> </td> </tr> 1 2 3 4 5 6 7 8 <b class="add-‐bubble"></b>
3.5% spd improvemt
did lp?
January February March April May June July August September October
November 0 150 300 450 600 pagoad me st 12 ms
January February March April May June July August September October
November 0 150 300 450 600 pagoad me st 12 ms
January February March April May June July August September October
November 0 150 300 450 600 pagoad me st 12 ms
shortcuts GHub’s
GHub Prim
facr c usab compts
SWT! C
SWT! C secrs
SS powful dgs
button.classy, a.button.classy, button.classy:disabled:hover, a.button.classy.disabled:hover { border-‐radius: 3px; &.primary
{ color: #fff; &:hover { border-‐color: #4a993e; } &.mousedown { border-‐bottom-‐color: darken(#8add6d, 10%); } &:disabled, &.disabled { &, &:hover { border-‐color: #74bb5a; } } } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14
button.classy:disabled:hover. mousedown,a.button.classy:dis abled:hover.mousedown,a.butto n.classy.disabled:hover.mouse down...
Max 3 vs
Wow, w sy
NOPE
GHub s grown
peop who ucd c
c vops
strat sucks!
GHub op like op srce
tools GHub’s
C Exp
“Think of it like SQL EXPLAIN, but for CSS selectors.”
- https://github.com/josh/css-explain
> cssExplain("li .item") { "selector": "li .item", "parts":
["li", ".item"], "specificity": [0, 1, 1], "category": "class", "key": "item", "score": 6 }
Webk Dev Tls
C Prir
Time
Auds
Graphe
“Graphite is a highly scalable real-time graphing system.” - http://graphite.wikidot.com/faq
cb (backd)
“Data collection agents connect to carbon and send their data...”
- http://graphite.wikidot.com/carbon
whp (DB)
“It provides fast, reliable storage of numeric data over time.”
- http://graphite.wikidot.com/whisper
T Graph S
Graphs Evyw
too long; didn’t read J Ron’s
Simplifi C
Try mimize HTML DOM mcs
Refacr use C
Tmwk
Graph M Evyg