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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
3.9k
技術的負債との付き合い方 〜プロダクトミライ会議〜
pokohide
0
150
Railsアプリで秘匿情報を環境変数からCredentialsに移行した話
pokohide
2
660
TechTrain RoRハンズオン
pokohide
0
1.4k
Other Decks in Programming
See All in Programming
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
160
Go のフラットな パッケージに 「ファイル単位の private」を 〜Linter “declscope” を作った話〜
mpyw
0
220
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
220
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
0
600
App Intentsのビルドプロセスを支える技術
kntkymt
0
330
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
320
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.1k
一参加者から『中の人』へ 〜全通PHPerがブースに立って学んだ、カンファレンスを100倍楽しむコツ〜
wp_daisuke
0
150
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
180
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
450
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
140
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
187
23k
Abbi's Birthday
coloredviolet
3
9.9k
The browser strikes back
jonoalderson
0
1.7k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
230
Product Roadmaps are Hard
iamctodd
55
13k
Agile that works and the tools we love
rasmusluckow
331
22k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Deep Space Network (abreviated)
tonyrice
0
300
Code Review Best Practice
trishagee
74
20k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
Side Projects
sachag
456
43k
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