Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ブラウザとフレンズになろう
Search
pokohide
April 02, 2018
Programming
74
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ブラウザとフレンズになろう
pokohide
April 02, 2018
More Decks by pokohide
See All by pokohide
Control Planeで育てるBtoB SaaSの認証基盤 - SRE NEXT 2026
pokohide
1
4.2k
技術的負債との付き合い方 〜プロダクトミライ会議〜
pokohide
0
150
Railsアプリで秘匿情報を環境変数からCredentialsに移行した話
pokohide
2
660
TechTrain RoRハンズオン
pokohide
0
1.4k
Other Decks in Programming
See All in Programming
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
160
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
260
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
Java 27新機能 / Java 27 new features
kishida
2
210
Simple Storage Service(S3) is not simple
iwatsukayura
0
230
SREの越境 / SRE Collaboration
y0hgi
2
300
JRuby: Past, Present, and Future
headius
0
230
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
120
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
170
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.8k
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
150
dotNET_vulnclicker_intro.pdf
deka_morita
0
130
Featured
See All Featured
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
980
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
The browser strikes back
jonoalderson
0
1.8k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
870
WCS-LA-2024
lcolladotor
0
860
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
350
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
350
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Designing for Timeless Needs
cassininazir
1
520
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
420
Utilizing Notion as your number one productivity tool
mfonobong
4
610
Transcript
ϒϥβͱϑϨϯζʹͳΖ͏ ※1͔͠ݟͨ͜ͱͳ͍Ͱ͢
ࣗݾհ • ໊લɿञҪӳ৳( Ά͜ͻͰ ) • OthloTechӡӦද • ීஈWEB͞Μ(Ruby, Node,
React, etc…) • झຯɿөըؑ(Hulu), ήʔϜ࣮گ(ఋऀ), ςχε IZEFBCMF IZEF
ϒϥβͱϑϨϯζʹͳΖ͏ ※1͔͠ݟͨ͜ͱͳ͍Ͱ͢
Browser
Browser • Firefox, Chrome, Safari ʢOpen Sourceʣ • WEBϖʔδͱ͔දࣔ͢Δͭ
ϨϯμϦϯάͷྲྀΕ(Webkit)
DOM (Document Object Model)
DOM • HTML, XMLͷυΩϡϝϯτΛૢ࡞͢ΔͨΊͷAPI • *MLܥͷDocumentߏ → DOM Tree
HTML DOM Tree : example 1 <!DOCTYPE html> 2 <html>
3 <head> 4 <title>OthloTech</title> 5 </head> 6 <body> 7 <a href="#">hoge</a> 8 </body> 9 </html> %PDVNFOU IUNM3PPUFMFNFOU IFBE&MFNFOU CPEZFMFNFOU UJUMF&MFNFOU B&MFNFOU l0UIMP5FDIz5FYU lISFGz"UUSJCVUF lIPHFz5FYU
Parse
ϨϯμϦϯάͷྲྀΕ(Webkit)
HTMLղੳ 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>OthloTech</title>
5 </head> 6 <body> 7 <a href="#">hoge</a> 8 </body> 9 </html> %PDVNF IUNM3PPU IFBE CPEZ UJUMF B l0UIMP5FDI lISFGz lIPHFz )5.-%PDVNFOU ࣈ۟ղੳ ߏจղੳ %0.5SFF
ղੳΞϧΰϦζϜ(HTML) • HTML௨ৗͷτοϓμϯύʔαʔɺϘτϜ ΞοϓύʔαʔͰղੳͰ͖ͳ͍ • ϒϥβʹΑͬͯΤϥʔΛڐ༰͢Δ͔Β • JSͷdocument.writeͳͲͰղੳॲཧதʹมߋ͕ೖΔ͜ͱ͕ ͋Δ͔Β
ղੳΞϧΰϦζϜ(HTML) • ʮτʔΫϯԽʯͱʮπϦʔߏஙʯͷ2ஈ֊ )5.-༷ͰղੳΞϧΰϦζϜ͕ղઆ͞Ε͍ͯ ͍ΔͷͰڵຯͷ͋ΔਓݟͯΈ͍ͯͩ͘͞ IUUQTXXXXPSH538%IUNMQBSTJOHIUNM
Τϥʔͷڐ༰(HTML) • HTML༷ͰΤϥʔॲཧنఆ͞Ε͍ͯͳ͍ • <br> ͷΘΓͷ </br> → <br>ͱͯ͠ॲཧ •
ೖΕࢠͷϑΥʔϜཁૉ → formͷformແࢹ • ਂ͗͢Δλά֊ → ಉ͡छྨͷλάͷೖΕࢠ 20·Ͱ 8FCLJUͷྫ
ϨϯμϦϯάͷྲྀΕ(Webkit)
CSSղੳ(Webkit)
ScriptͱStyleSheetͷॲཧॱং • StyleSheetཧతʹDOM TreeΛߋ৽͠ͳ͍ • ղੳΛதஅ͠ͳͯ͘Αͦ͞͏ → NO • StyleSheetΛಡΈࠐΉ·ͰScriptΛϒϩοΫ(Firefox)
• HTML5ͳΒasyncΛ͚ͭͯɺผεϨουͰղੳ/࣮ߦ
ϨϯμϦϯάͷྲྀΕ
Render Tree • ࢹ֮తͳཁૉΛදࣔॱʹฒͨߏ • DOMཁૉʹରԠ͍ͯ͠Δ͕̍ର̍Ͱͳ͍ • headཁૉ, display:noneͷཁૉؚ·Εͳ͍ •
visiblity: hiddenཁૉؚ·ΕΔ
Render Treeߏ • ελΠϧγʔτͷΧεέʔυॱং • ϒϥβͷએݴ • Ϣʔβʔͷ௨ৗͷએݴ • ੍࡞ऀͷ௨ৗͷએݴ
• ੍࡞ऀͷॏཁͳએݴ • Ϣʔβʔͷॏཁͳએݴ(!important) ߴ ಉ͡ॱংͷ߹ ผͷϧʔϧͰஅ
ηϨΫλͷಛҟੜ • HTMLͷʮstyleʯଐੑʹ͋Δ߹1, ͦΕҎ֎0 (=a) • ηϨΫλͷIDଐੑͷ (=b) • ηϨΫλͷଞͷଐੑͱٙࣅΫϥεͷ
(=c) • ηϨΫλͷཁૉ໊ͱٙࣅཁૉͷ (=d) YBCDEͰࢉग़ IUUQTXXXXPSH53DTTDBTDBEF
Layout, Paint
ϨϯμϦϯάͷྲྀΕ
Layout (Reflow) • Render TreeʹҐஔαΠζͷใ͕ͳ͍ͷͰɺ͜͜ Ͱ֤DOMཁૉͷҐஔΛܾఆ͢Δ • DOMͷૢ࡞, ΟϯυͷϦαΠζ, εΫϩʔϧͷͨͼ
ʹൃੜ • ͍ཁҼओʹ͍ͭ͜
Paint • color, background-colorͳͲͷࢹ֮తͳελΠϧ • ࢹ֮తͳใͳͷͰɺͪΐͬͽΓॏ͍
LayoutPaintΛҾ͖ى͜͢ݪҼ • DOMϊʔυͷՃɺมߋɺআ • εΫϩʔϧ • ελΠϧͷมߋ • :hoverٖࣅΫϥεͳͲͷΠϕϯτൃੜ
͜͜·Ͱͷ·ͱΊ • CSSͷCascade Rule͓͍ͬͯͯଛͳ͍ • Layout(Reflow)͕ॏ͍ʂ͚͍ͩͬͯΕେৎ
ύϑΥʔϚϯε্
LayoutճΛݮΒ͢ • ʮvisiblity: hiddenʯ < ʮdisplay: noneʯ • ʮposition:fixedʯͷݻఆϨΠΞτෛՙେ •
ϒϥβʹैॱʹ 1BJOU -BZPVU 1BJOU εΫϩʔϧͷͨͼʹ-BZPVU Ұճ͔͠-BZPVU͠ͳ͍
·ͱΊ • ߏͱ͔େֶͰษڧ͠ͱ͍ͨΒཱ͍͔ͭ ͭʢదʣ • ָ͍͠ • https://developers.google.com/web/ fundamentals/performance/rendering/?hl=ja
͋Γ͕ͱ͏͍͟͝·ͨ͠
DOM͍͠ • DOMཁૉͷมߋՃ͕͋ͬͨ࣌ͷॲཧ • DOM͕ߏ͔ͷνΣοΫ • DOMͷ୳ࡧ • ߏͷมԽͷ௨ •
Render Treeߏ, Layout, Paint… • ͳΜ͔ͦ͠͏ • มߋ෦͚ͩҰؾʹૹΕͳ͍ͷ͔ͳ(´ɾωɾʆ)
Virtual DOM
Virtual DOM • DOMΛ࡞ΔͷʹඞཁͳใΛ࣋ͭjsΦϒδΣΫτ • جຊతͳػೳ • Virtual DOMʹରͯ͠ૢ࡞Λߦ͏ͱɺૢ࡞લͱૢ࡞ޙͷࠩ ใ͔ΒదʹDOMͷߋ৽ૢ࡞Λߦ͏
Virtual DOM : Update previous current Virtual DOM DOM diff
patch apply
Virtual DOMͷ࣮ • React.js • virtual-dom • Mithril.js etc.
Virtual DOMͷ • Virtual DOMΛߋ৽͢ΔࡍʹVirtual DOM TreeΛ2ͭ࡞ Δඞཁ͕ੜ͡Δ • ͜ΕϝϞϦΛѹഭͤ͞ΔཁҼʹͳΔ
Incremental DOM
Incremental DOM • جຊతͳߟ͑ํvirtual DOMͱಉ͡ • ৽͍͠(Virtual) DOM TreeΛ࡞Γͳ͕Βɺ(࣮ࡍͷ) DOM
TreeΛwalkͭͭ͠มߋ͍ͯ͘͠ͷͰϝϞϦʹ༏͍͠ • Virtual DOMͷΑ͏ʹมߋલͱมߋޙͷ̎ͭͷԾDOM Tree͕ඞཁͳ͍
Incremental DOM : update Virtual DOM DOM diff patch diff
Meta Meta Meta Meta Meta Meta apply compare compare compare compare compare compare
ࢀߟจݙ • https://www.html5rocks.com/ja/tutorials/ internals/howbrowserswork/ • http://steps.dodgson.org/b/2014/12/11/ why-is-real-dom-slow/ • https://developers.google.com/web/ fundamentals/performance/rendering/?hl=ja