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
V8
Search
dimko1
September 13, 2015
Programming
280
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
V8
How V8 Works
dimko1
September 13, 2015
More Decks by dimko1
See All by dimko1
Anti-patterns
dimko1
0
63
JS under the hood
dimko1
0
200
Other Decks in Programming
See All in Programming
最近”作らせてる” ローカルAIアプリの話
akit37
0
470
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
610
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
Domain-Driven Transformation
hschwentner
2
2.3k
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
150
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
3.8k
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
510
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
96
6.9k
Color Theory Basics | Prateek | Gurzu
gurzu
1
490
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
730
Optimizing for Happiness
mojombo
378
71k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
220
The untapped power of vector embeddings
frankvandijk
2
1.9k
Fireside Chat
paigeccino
43
4.1k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Paper Plane (Part 1)
katiecoart
PRO
2
12k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
600
Transcript
V8 by @dimko1
What? • Googles Open Source Engine • Written on C++
• Compiles JS into Machine Code at execution (JIT) without producing byte code • Powers Chrome, Node, Opera • Can run standalone, or can be embedded into any C++ program
Made in Germany
None
So, why to know? • Have no idea:)
Demo
Hidden Classes • We don’t have types. (oh c’mon, not
about primitives) • To optimise we need types… • Types information is valuable for code generation • Remember: Compilation during Execution
Hidden Classes help to run faster • Creating hidden classes
for objects during run- time • Objects with same hidden class can use same optimised code
None
None
Summary • Initialise all members in construction function • Initialise
members in same order
Tagging • V8 represent JavaScript objects with 32 bits values
• Object has flag 1 • Integer has flag 0 and called SMI • If bigger - turning it into double and create new object
None
Summary • Prefer numeric values that can be represented as
31-bit integer
Arrays • We have arrays, huge array and sparse arrays
• Two ways of representing arrays: • Fast Elements • Dictionary Elements
Summary • Create arrays from 0 index :) • Don’t
pre-allocate large Arrays • Don’t delete element from array • Don't load uninitialized or deleted elements
None
None
None
Summary 2 • User Array Literal: var a = [77,
88, 0.5, true] • Don’t store non numeric values in numeric arrays
Compilers • “Full” compiler can generate good code for any
JavaScript • Optimizing compiler produces great code for most JavaScript
Full Compiler • Generate code quickly • Does do no
type analysis • Using Inline Caching. Gather type information in runtime
How Inline Cache Works • Type dependant code for operations
• Validate type assumptions first • Change at runtime as more types discovered
None
None
None
Monomorphic better than Polymorphic
Optimizing Compiler • Comes later and re-compiles “hot” functions •
Types taken form ICs • Monomorphic can be inlined • Inlining enables other optimizations
None
None
Deoptimization • Optimization are speculative • Throws away optimized code
• Resumes execution at the right place • Reoptimization might be triggered again later
Summary • Avoid changes in the hidden classes after functions
were optimised
What is a problem now? • Ensure problem is in
JS • Reduce to pure JS ( not DOM ) • Collect metrics
Demo
?