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
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
0
1.2k
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.2k
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
340
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
1
430
ジョジョの世界をXRで再現する
mofurune
0
160
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
Featured
See All Featured
My Coaching Mixtape
mlcsv
0
360
Claude Code のすすめ
schroneko
67
230k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Typedesign – Prime Four
hannesfritz
42
3.2k
Marketing to machines
jonoalderson
1
5.9k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
GraphQLとの向き合い方2022年版
quramy
50
15k
Evolving SEO for Evolving Search Engines
ryanjones
0
330
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Building Adaptive Systems
keathley
44
3.2k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
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
?