SlideShare a Scribd company logo
JSX Optimizer
    DeNA Co., Ltd.
     Kazuho Oku
The Basic Idea of the JSX Optimizer




    perform optimizations that JavaScript VMs
                     cannot




Jul 19 2012             JSX Optimizer       2
Benchmark Scores

   Box2D.jsx
         +13.5% (iOS 5.0, iPhone 4)
         +11.8% (iOS 5.1, iPhone 4S)
         +28.7% (Android 2.3, Xperia ray)
         numbers are increase in fps
   ToDo: post the details



Jul 19 2012                 JSX Optimizer    3
The Nature of JavaScript

   a dynamic language
         primitives are untyped
              a + 1 becomes "a1" if a is "a", 2 if a is 1
         objects are untyped
              a.p may point to whatever

   solution: inline caching
         V8, JavaScriptCore, SpiderMonkey



Jul 19 2012                        JSX Optimizer             4
Inline Caching

   The idea:
         most of the code will be called with the same
          types of arguments
         cache the expectation at the call site
   Example: point.x
         type of point will be { x: ?, y: ? }
         thus if the expectation succeeded, point.x will be:
              load point_addr[offset_of_x]


Jul 19 2012                     JSX Optimizer                   5
Guards in Inline Caching

   Example: a = b.p + 1
         typeof(b) is as expected
         load b.p
         typeof(b.p) is number
         add one
         store the result




Jul 19 2012                 JSX Optimizer   6
Guards in Inline Caching (cont'd)

   Example: f()
         typeof(f) is function
         setup stack frame
         jump to the code of f




Jul 19 2012                 JSX Optimizer   7
Guards in Inline Caching (cont'd)

   Example: f() // after inlined
         typeof(f) is function
          f has not been altered
         execute the code expanded in-line




Jul 19 2012                 JSX Optimizer     8
Guards in Inline Caching (cont'd)

   Example: o.f()
         typeof(o) is as expected
         load o.prototype
         typeof (o.prototype) is as expected
         load o.prototype.f
         typeof(f) is function
         setup stack frame
         jump to the code of f


Jul 19 2012                  JSX Optimizer      9
Guards in Inline Caching (cont'd)

   Example: o.f() // after inlined
         typeof(o) is as expected
         load o.prototype
         typeof (o.prototype) is as expected
         load o.prototype.f
         typeof(f) is function
          f has not been altered
         execute the code expanded in-line


Jul 19 2012                  JSX Optimizer      10
What interpreters do / do not

   inter-statement optimization
         V8 does
         SpiderMonkey and JavaScriptCore seem not
   inline-expand the JavaScript functions
         at least V8 does




Jul 19 2012                  JSX Optimizer           11
JSX optimizer

   minimizes the need for IC
         caches property access
              JSX does not have accessors (Object.defineProperty)
         inline-expands the functions
         converts member methods to static functions
   generates IC-friendly code
         always initializes the properties in same order
              Note: { x: 0, y: 0 } and { y: 1, x: 1 } are different
               types

Jul 19 2012                        JSX Optimizer                       12
JSX optimizer

   minimizes the pressure on GC
         unboxing
   folds constants
         JavaScript does not have a true const




Jul 19 2012                 JSX Optimizer         13
Example: affine transformation

   input:
         new Matrix(1, 0, 0, 0, 2, 0).transform(new Point(x, y))

   output:
         {x: x + 0 * y, y: 0 * x + 2 * y}

         Note: 0 * n cannot be optimized to 0, since it becomes NaN if n is NaN




Jul 19 2012                                 JSX Optimizer                         14
Current Optimization Subcommands

      lto
      no-assert
      no-log
      unclassify
      fold-const
      inline
      dce
      return-if
      lcse
      unbox
      array-length
Jul 19 2012             JSX Optimizer     15
Diffs. from an ordinary optimizing compiler

   ordinary compiler
         generate a low-level non-redundant code
   JSX compiler
         most code are left as is
         while optimizing the code wherever possible




Jul 19 2012                 JSX Optimizer               16
The Difficulties and Considerations

   switch to SSA-based code?
         might end-up in generating a very different code
          from source
              would be difficult to debug (by the users)
              may become slow (than the same-looking code in
               JavaScript); GCC has the problem
         it is troublesome to optimize the code while
          maintaining the original code structure
              example. support various kind of loops: do-while, for,
               for..in, while

Jul 19 2012                       JSX Optimizer                         17
The Difficulties and Considerations (cont'd)

   Other optimization techniques?
         inline allocation?
         more powerful dce / dse
         reduce the number of locals?




Jul 19 2012                 JSX Optimizer            18
Some Microbenchmarks
   http://jsperf.com/local-vs-member/2
   http://jsperf.com/construct-object-vs-array/3
   http://jsperf.com/inherit-object-vs-array-set
   http://jsperf.com/vars-in-nested-closure




Jul 19 2012                            JSX Optimizer   19

More Related Content

What's hot

Configuring in the Browser, Really!
Configuring in the Browser, Really!Configuring in the Browser, Really!
Configuring in the Browser, Really!
Tim Geisler
 
Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...
Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...
Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...
Nuxeo
 
openCPQ - A React-Based Product-Configuration Toolkit
openCPQ - A React-Based Product-Configuration ToolkitopenCPQ - A React-Based Product-Configuration Toolkit
openCPQ - A React-Based Product-Configuration Toolkit
Tim Geisler
 
Practical Domain-Specific Languages in Groovy
Practical Domain-Specific Languages in GroovyPractical Domain-Specific Languages in Groovy
Practical Domain-Specific Languages in GroovyGuillaume Laforge
 
PHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success StoryPHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success Story
Michael Spector
 
CSS :has() - The story so far and the path ahead
CSS :has() - The story so far and the path aheadCSS :has() - The story so far and the path ahead
CSS :has() - The story so far and the path ahead
Igalia
 
Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...elliando dias
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questionsMir Majid
 
Professional JavaScript Development (An Introduction for Java Developers)
Professional JavaScript Development (An Introduction for Java Developers)Professional JavaScript Development (An Introduction for Java Developers)
Professional JavaScript Development (An Introduction for Java Developers)
jbandi
 

What's hot (9)

Configuring in the Browser, Really!
Configuring in the Browser, Really!Configuring in the Browser, Really!
Configuring in the Browser, Really!
 
Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...
Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...
Creating Large Scale Software Platforms with OSGi and an Extension Point Mode...
 
openCPQ - A React-Based Product-Configuration Toolkit
openCPQ - A React-Based Product-Configuration ToolkitopenCPQ - A React-Based Product-Configuration Toolkit
openCPQ - A React-Based Product-Configuration Toolkit
 
Practical Domain-Specific Languages in Groovy
Practical Domain-Specific Languages in GroovyPractical Domain-Specific Languages in Groovy
Practical Domain-Specific Languages in Groovy
 
PHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success StoryPHP Development Tools 2.0 - Success Story
PHP Development Tools 2.0 - Success Story
 
CSS :has() - The story so far and the path ahead
CSS :has() - The story so far and the path aheadCSS :has() - The story so far and the path ahead
CSS :has() - The story so far and the path ahead
 
Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...Language-Oriented Programming and Language Workbenches: Building Domain Langu...
Language-Oriented Programming and Language Workbenches: Building Domain Langu...
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questions
 
Professional JavaScript Development (An Introduction for Java Developers)
Professional JavaScript Development (An Introduction for Java Developers)Professional JavaScript Development (An Introduction for Java Developers)
Professional JavaScript Development (An Introduction for Java Developers)
 

Viewers also liked

JSX Design Overview (日本語)
JSX Design Overview (日本語)JSX Design Overview (日本語)
JSX Design Overview (日本語)Kazuho Oku
 
Test Engineering on Mobage
Test Engineering on MobageTest Engineering on Mobage
Test Engineering on Mobage
Masaki Nakagawa
 
OpenVis Conference Report Part 1 (and Introduction to D3.js)
OpenVis Conference Report Part 1 (and Introduction to D3.js)OpenVis Conference Report Part 1 (and Introduction to D3.js)
OpenVis Conference Report Part 1 (and Introduction to D3.js)
Keiichiro Ono
 
Sprawne Smoki 2010-2011
Sprawne Smoki 2010-2011Sprawne Smoki 2010-2011
Sprawne Smoki 2010-2011
Maria Ptak
 
Lyddie: Unit2 lesson1
Lyddie: Unit2 lesson1Lyddie: Unit2 lesson1
Lyddie: Unit2 lesson1
Terri Weiss
 
Sprawozdanie
SprawozdanieSprawozdanie
Sprawozdanie
Maria Ptak
 
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
Guy Haviv
 
102報稅懶人包
102報稅懶人包102報稅懶人包
102報稅懶人包olivertw
 
Chef - the second presentation
Chef - the second presentationChef - the second presentation
Chef - the second presentation
Robert Postill
 
Lyddie: Unit3 lesson9
Lyddie: Unit3 lesson9Lyddie: Unit3 lesson9
Lyddie: Unit3 lesson9
Terri Weiss
 
Overview for Technical Nearshore Investment in Costa Rica
Overview for Technical Nearshore Investment in Costa RicaOverview for Technical Nearshore Investment in Costa Rica
Overview for Technical Nearshore Investment in Costa Rica
Andrea Tanzi
 
The Roots of Innovation
The Roots of InnovationThe Roots of Innovation
The Roots of Innovation
Raffaele Vincenti
 
Donde esta el Dios de justicia
Donde esta el Dios de justiciaDonde esta el Dios de justicia
Donde esta el Dios de justiciaPaulo Arieu
 
What's in a habitat?
What's in a habitat?What's in a habitat?
What's in a habitat?Russell Ogden
 
Origen, filosofía
Origen, filosofíaOrigen, filosofía
Origen, filosofía
Leandro Villalobos
 
Электронные журналы для планшетов. Новые возможности в Magtoapp Editor 1.42
Электронные журналы для планшетов. Новые возможности в Magtoapp Editor 1.42Электронные журналы для планшетов. Новые возможности в Magtoapp Editor 1.42
Электронные журналы для планшетов. Новые возможности в Magtoapp Editor 1.42
Maria Podolyak
 
A Tour of Google Earth
A Tour of Google EarthA Tour of Google Earth
A Tour of Google Earth
Heather Dowd
 
Clientbridge
ClientbridgeClientbridge
Clientbridge
Mikhail Grafsky
 
ruchome miejsca i etnografia translokalności
ruchome miejsca i etnografia translokalnościruchome miejsca i etnografia translokalności
ruchome miejsca i etnografia translokalności
agata stanisz
 

Viewers also liked (20)

JSX Design Overview (日本語)
JSX Design Overview (日本語)JSX Design Overview (日本語)
JSX Design Overview (日本語)
 
Test Engineering on Mobage
Test Engineering on MobageTest Engineering on Mobage
Test Engineering on Mobage
 
OpenVis Conference Report Part 1 (and Introduction to D3.js)
OpenVis Conference Report Part 1 (and Introduction to D3.js)OpenVis Conference Report Part 1 (and Introduction to D3.js)
OpenVis Conference Report Part 1 (and Introduction to D3.js)
 
Sprawne Smoki 2010-2011
Sprawne Smoki 2010-2011Sprawne Smoki 2010-2011
Sprawne Smoki 2010-2011
 
EDiNEB 2010
EDiNEB 2010EDiNEB 2010
EDiNEB 2010
 
Lyddie: Unit2 lesson1
Lyddie: Unit2 lesson1Lyddie: Unit2 lesson1
Lyddie: Unit2 lesson1
 
Sprawozdanie
SprawozdanieSprawozdanie
Sprawozdanie
 
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
Bezalel: Introduction to Interactive Design: ב4 - מבוא לעיצוב אינטראקטיבי - ה...
 
102報稅懶人包
102報稅懶人包102報稅懶人包
102報稅懶人包
 
Chef - the second presentation
Chef - the second presentationChef - the second presentation
Chef - the second presentation
 
Lyddie: Unit3 lesson9
Lyddie: Unit3 lesson9Lyddie: Unit3 lesson9
Lyddie: Unit3 lesson9
 
Overview for Technical Nearshore Investment in Costa Rica
Overview for Technical Nearshore Investment in Costa RicaOverview for Technical Nearshore Investment in Costa Rica
Overview for Technical Nearshore Investment in Costa Rica
 
The Roots of Innovation
The Roots of InnovationThe Roots of Innovation
The Roots of Innovation
 
Donde esta el Dios de justicia
Donde esta el Dios de justiciaDonde esta el Dios de justicia
Donde esta el Dios de justicia
 
What's in a habitat?
What's in a habitat?What's in a habitat?
What's in a habitat?
 
Origen, filosofía
Origen, filosofíaOrigen, filosofía
Origen, filosofía
 
Электронные журналы для планшетов. Новые возможности в Magtoapp Editor 1.42
Электронные журналы для планшетов. Новые возможности в Magtoapp Editor 1.42Электронные журналы для планшетов. Новые возможности в Magtoapp Editor 1.42
Электронные журналы для планшетов. Новые возможности в Magtoapp Editor 1.42
 
A Tour of Google Earth
A Tour of Google EarthA Tour of Google Earth
A Tour of Google Earth
 
Clientbridge
ClientbridgeClientbridge
Clientbridge
 
ruchome miejsca i etnografia translokalności
ruchome miejsca i etnografia translokalnościruchome miejsca i etnografia translokalności
ruchome miejsca i etnografia translokalności
 

Similar to JSX Optimizer

Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
Eugene Lazutkin
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS Meetup
LINAGORA
 
Performance #5 cpu and battery
Performance #5  cpu and batteryPerformance #5  cpu and battery
Performance #5 cpu and battery
Vitali Pekelis
 
How to develop an iOS application
How to develop an iOS applicationHow to develop an iOS application
How to develop an iOS application
Le Quang
 
Modern server side development with node.js - Benjamin gruenbaum
Modern server side development with node.js - Benjamin gruenbaumModern server side development with node.js - Benjamin gruenbaum
Modern server side development with node.js - Benjamin gruenbaum
geektimecoil
 
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Igalia
 
Decorating code (Research Paper)
Decorating code (Research Paper)Decorating code (Research Paper)
Decorating code (Research Paper)Jenna Pederson
 
I os
I osI os
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalNAVER D2
 
Dojo Toolkit from a Flex developer's perspective
Dojo Toolkit from a Flex developer's perspectiveDojo Toolkit from a Flex developer's perspective
Dojo Toolkit from a Flex developer's perspective
cjolif
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
GuardSquare
 
Welcome to React & Flux !
Welcome to React & Flux !Welcome to React & Flux !
Welcome to React & Flux !Ritesh Kumar
 
High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14
Matthieu Garrigues
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application Development
Ramesh Prasad
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
Phil Eaton
 
Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014
Paris Android User Group
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
Jonathan Fine
 
Integrate Spring MVC with RequireJS & Backbone.js & Spring Data JPA
Integrate Spring MVC with RequireJS & Backbone.js & Spring Data JPAIntegrate Spring MVC with RequireJS & Backbone.js & Spring Data JPA
Integrate Spring MVC with RequireJS & Backbone.js & Spring Data JPA
Cheng Ta Yeh
 
Ajax for-coldfusion-developers
Ajax for-coldfusion-developersAjax for-coldfusion-developers
Ajax for-coldfusion-developersSudhakar Ganta
 

Similar to JSX Optimizer (20)

Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
 
Java 8 Lambda
Java 8 LambdaJava 8 Lambda
Java 8 Lambda
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS Meetup
 
Performance #5 cpu and battery
Performance #5  cpu and batteryPerformance #5  cpu and battery
Performance #5 cpu and battery
 
How to develop an iOS application
How to develop an iOS applicationHow to develop an iOS application
How to develop an iOS application
 
Modern server side development with node.js - Benjamin gruenbaum
Modern server side development with node.js - Benjamin gruenbaumModern server side development with node.js - Benjamin gruenbaum
Modern server side development with node.js - Benjamin gruenbaum
 
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
Stranger in These Parts. A Hired Gun in the JS Corral (JSConf US 2012)
 
Decorating code (Research Paper)
Decorating code (Research Paper)Decorating code (Research Paper)
Decorating code (Research Paper)
 
I os
I osI os
I os
 
Kandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_finalKandroid for nhn_deview_20131013_v5_final
Kandroid for nhn_deview_20131013_v5_final
 
Dojo Toolkit from a Flex developer's perspective
Dojo Toolkit from a Flex developer's perspectiveDojo Toolkit from a Flex developer's perspective
Dojo Toolkit from a Flex developer's perspective
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
 
Welcome to React & Flux !
Welcome to React & Flux !Welcome to React & Flux !
Welcome to React & Flux !
 
High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application Development
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
 
Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
Integrate Spring MVC with RequireJS & Backbone.js & Spring Data JPA
Integrate Spring MVC with RequireJS & Backbone.js & Spring Data JPAIntegrate Spring MVC with RequireJS & Backbone.js & Spring Data JPA
Integrate Spring MVC with RequireJS & Backbone.js & Spring Data JPA
 
Ajax for-coldfusion-developers
Ajax for-coldfusion-developersAjax for-coldfusion-developers
Ajax for-coldfusion-developers
 

More from Kazuho Oku

HTTP/2で 速くなるとき ならないとき
HTTP/2で 速くなるとき ならないときHTTP/2で 速くなるとき ならないとき
HTTP/2で 速くなるとき ならないとき
Kazuho Oku
 
QUIC標準化動向 〜2017/7
QUIC標準化動向 〜2017/7QUIC標準化動向 〜2017/7
QUIC標準化動向 〜2017/7
Kazuho Oku
 
HTTP/2の課題と将来
HTTP/2の課題と将来HTTP/2の課題と将来
HTTP/2の課題と将来
Kazuho Oku
 
TLS 1.3 と 0-RTT のこわ〜い話
TLS 1.3 と 0-RTT のこわ〜い話TLS 1.3 と 0-RTT のこわ〜い話
TLS 1.3 と 0-RTT のこわ〜い話
Kazuho Oku
 
Reorganizing Website Architecture for HTTP/2 and Beyond
Reorganizing Website Architecture for HTTP/2 and BeyondReorganizing Website Architecture for HTTP/2 and Beyond
Reorganizing Website Architecture for HTTP/2 and Beyond
Kazuho Oku
 
Recent Advances in HTTP, controlling them using ruby
Recent Advances in HTTP, controlling them using rubyRecent Advances in HTTP, controlling them using ruby
Recent Advances in HTTP, controlling them using ruby
Kazuho Oku
 
Programming TCP for responsiveness
Programming TCP for responsivenessProgramming TCP for responsiveness
Programming TCP for responsiveness
Kazuho Oku
 
Programming TCP for responsiveness
Programming TCP for responsivenessProgramming TCP for responsiveness
Programming TCP for responsiveness
Kazuho Oku
 
Developing the fastest HTTP/2 server
Developing the fastest HTTP/2 serverDeveloping the fastest HTTP/2 server
Developing the fastest HTTP/2 server
Kazuho Oku
 
TLS & LURK @ IETF 95
TLS & LURK @ IETF 95TLS & LURK @ IETF 95
TLS & LURK @ IETF 95
Kazuho Oku
 
HTTPとサーバ技術の最新動向
HTTPとサーバ技術の最新動向HTTPとサーバ技術の最新動向
HTTPとサーバ技術の最新動向
Kazuho Oku
 
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
Kazuho Oku
 
Cache aware-server-push in H2O version 1.5
Cache aware-server-push in H2O version 1.5Cache aware-server-push in H2O version 1.5
Cache aware-server-push in H2O version 1.5
Kazuho Oku
 
HTTP/2時代のウェブサイト設計
HTTP/2時代のウェブサイト設計HTTP/2時代のウェブサイト設計
HTTP/2時代のウェブサイト設計
Kazuho Oku
 
H2O - making the Web faster
H2O - making the Web fasterH2O - making the Web faster
H2O - making the Web faster
Kazuho Oku
 
H2O - making HTTP better
H2O - making HTTP betterH2O - making HTTP better
H2O - making HTTP better
Kazuho Oku
 
H2O - the optimized HTTP server
H2O - the optimized HTTP serverH2O - the optimized HTTP server
H2O - the optimized HTTP server
Kazuho Oku
 
JSON SQL Injection and the Lessons Learned
JSON SQL Injection and the Lessons LearnedJSON SQL Injection and the Lessons Learned
JSON SQL Injection and the Lessons Learned
Kazuho Oku
 
JSX 速さの秘密 - 高速なJavaScriptを書く方法
JSX 速さの秘密 - 高速なJavaScriptを書く方法JSX 速さの秘密 - 高速なJavaScriptを書く方法
JSX 速さの秘密 - 高速なJavaScriptを書く方法
Kazuho Oku
 
JSX の現在と未来 - Oct 26 2013
JSX の現在と未来 - Oct 26 2013JSX の現在と未来 - Oct 26 2013
JSX の現在と未来 - Oct 26 2013
Kazuho Oku
 

More from Kazuho Oku (20)

HTTP/2で 速くなるとき ならないとき
HTTP/2で 速くなるとき ならないときHTTP/2で 速くなるとき ならないとき
HTTP/2で 速くなるとき ならないとき
 
QUIC標準化動向 〜2017/7
QUIC標準化動向 〜2017/7QUIC標準化動向 〜2017/7
QUIC標準化動向 〜2017/7
 
HTTP/2の課題と将来
HTTP/2の課題と将来HTTP/2の課題と将来
HTTP/2の課題と将来
 
TLS 1.3 と 0-RTT のこわ〜い話
TLS 1.3 と 0-RTT のこわ〜い話TLS 1.3 と 0-RTT のこわ〜い話
TLS 1.3 と 0-RTT のこわ〜い話
 
Reorganizing Website Architecture for HTTP/2 and Beyond
Reorganizing Website Architecture for HTTP/2 and BeyondReorganizing Website Architecture for HTTP/2 and Beyond
Reorganizing Website Architecture for HTTP/2 and Beyond
 
Recent Advances in HTTP, controlling them using ruby
Recent Advances in HTTP, controlling them using rubyRecent Advances in HTTP, controlling them using ruby
Recent Advances in HTTP, controlling them using ruby
 
Programming TCP for responsiveness
Programming TCP for responsivenessProgramming TCP for responsiveness
Programming TCP for responsiveness
 
Programming TCP for responsiveness
Programming TCP for responsivenessProgramming TCP for responsiveness
Programming TCP for responsiveness
 
Developing the fastest HTTP/2 server
Developing the fastest HTTP/2 serverDeveloping the fastest HTTP/2 server
Developing the fastest HTTP/2 server
 
TLS & LURK @ IETF 95
TLS & LURK @ IETF 95TLS & LURK @ IETF 95
TLS & LURK @ IETF 95
 
HTTPとサーバ技術の最新動向
HTTPとサーバ技術の最新動向HTTPとサーバ技術の最新動向
HTTPとサーバ技術の最新動向
 
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
 
Cache aware-server-push in H2O version 1.5
Cache aware-server-push in H2O version 1.5Cache aware-server-push in H2O version 1.5
Cache aware-server-push in H2O version 1.5
 
HTTP/2時代のウェブサイト設計
HTTP/2時代のウェブサイト設計HTTP/2時代のウェブサイト設計
HTTP/2時代のウェブサイト設計
 
H2O - making the Web faster
H2O - making the Web fasterH2O - making the Web faster
H2O - making the Web faster
 
H2O - making HTTP better
H2O - making HTTP betterH2O - making HTTP better
H2O - making HTTP better
 
H2O - the optimized HTTP server
H2O - the optimized HTTP serverH2O - the optimized HTTP server
H2O - the optimized HTTP server
 
JSON SQL Injection and the Lessons Learned
JSON SQL Injection and the Lessons LearnedJSON SQL Injection and the Lessons Learned
JSON SQL Injection and the Lessons Learned
 
JSX 速さの秘密 - 高速なJavaScriptを書く方法
JSX 速さの秘密 - 高速なJavaScriptを書く方法JSX 速さの秘密 - 高速なJavaScriptを書く方法
JSX 速さの秘密 - 高速なJavaScriptを書く方法
 
JSX の現在と未来 - Oct 26 2013
JSX の現在と未来 - Oct 26 2013JSX の現在と未来 - Oct 26 2013
JSX の現在と未来 - Oct 26 2013
 

Recently uploaded

ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 

Recently uploaded (20)

ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 

JSX Optimizer

  • 1. JSX Optimizer DeNA Co., Ltd. Kazuho Oku
  • 2. The Basic Idea of the JSX Optimizer perform optimizations that JavaScript VMs cannot Jul 19 2012 JSX Optimizer 2
  • 3. Benchmark Scores Box2D.jsx +13.5% (iOS 5.0, iPhone 4) +11.8% (iOS 5.1, iPhone 4S) +28.7% (Android 2.3, Xperia ray) numbers are increase in fps ToDo: post the details Jul 19 2012 JSX Optimizer 3
  • 4. The Nature of JavaScript a dynamic language primitives are untyped a + 1 becomes "a1" if a is "a", 2 if a is 1 objects are untyped a.p may point to whatever solution: inline caching V8, JavaScriptCore, SpiderMonkey Jul 19 2012 JSX Optimizer 4
  • 5. Inline Caching The idea: most of the code will be called with the same types of arguments cache the expectation at the call site Example: point.x type of point will be { x: ?, y: ? } thus if the expectation succeeded, point.x will be: load point_addr[offset_of_x] Jul 19 2012 JSX Optimizer 5
  • 6. Guards in Inline Caching Example: a = b.p + 1 typeof(b) is as expected load b.p typeof(b.p) is number add one store the result Jul 19 2012 JSX Optimizer 6
  • 7. Guards in Inline Caching (cont'd) Example: f() typeof(f) is function setup stack frame jump to the code of f Jul 19 2012 JSX Optimizer 7
  • 8. Guards in Inline Caching (cont'd) Example: f() // after inlined typeof(f) is function  f has not been altered execute the code expanded in-line Jul 19 2012 JSX Optimizer 8
  • 9. Guards in Inline Caching (cont'd) Example: o.f() typeof(o) is as expected load o.prototype typeof (o.prototype) is as expected load o.prototype.f typeof(f) is function setup stack frame jump to the code of f Jul 19 2012 JSX Optimizer 9
  • 10. Guards in Inline Caching (cont'd) Example: o.f() // after inlined typeof(o) is as expected load o.prototype typeof (o.prototype) is as expected load o.prototype.f typeof(f) is function  f has not been altered execute the code expanded in-line Jul 19 2012 JSX Optimizer 10
  • 11. What interpreters do / do not inter-statement optimization V8 does SpiderMonkey and JavaScriptCore seem not inline-expand the JavaScript functions at least V8 does Jul 19 2012 JSX Optimizer 11
  • 12. JSX optimizer minimizes the need for IC caches property access JSX does not have accessors (Object.defineProperty) inline-expands the functions converts member methods to static functions generates IC-friendly code always initializes the properties in same order Note: { x: 0, y: 0 } and { y: 1, x: 1 } are different types Jul 19 2012 JSX Optimizer 12
  • 13. JSX optimizer minimizes the pressure on GC unboxing folds constants JavaScript does not have a true const Jul 19 2012 JSX Optimizer 13
  • 14. Example: affine transformation input: new Matrix(1, 0, 0, 0, 2, 0).transform(new Point(x, y)) output: {x: x + 0 * y, y: 0 * x + 2 * y} Note: 0 * n cannot be optimized to 0, since it becomes NaN if n is NaN Jul 19 2012 JSX Optimizer 14
  • 15. Current Optimization Subcommands  lto  no-assert  no-log  unclassify  fold-const  inline  dce  return-if  lcse  unbox  array-length Jul 19 2012 JSX Optimizer 15
  • 16. Diffs. from an ordinary optimizing compiler ordinary compiler generate a low-level non-redundant code JSX compiler most code are left as is while optimizing the code wherever possible Jul 19 2012 JSX Optimizer 16
  • 17. The Difficulties and Considerations switch to SSA-based code? might end-up in generating a very different code from source would be difficult to debug (by the users) may become slow (than the same-looking code in JavaScript); GCC has the problem it is troublesome to optimize the code while maintaining the original code structure example. support various kind of loops: do-while, for, for..in, while Jul 19 2012 JSX Optimizer 17
  • 18. The Difficulties and Considerations (cont'd) Other optimization techniques? inline allocation? more powerful dce / dse reduce the number of locals? Jul 19 2012 JSX Optimizer 18
  • 19. Some Microbenchmarks http://jsperf.com/local-vs-member/2 http://jsperf.com/construct-object-vs-array/3 http://jsperf.com/inherit-object-vs-array-set http://jsperf.com/vars-in-nested-closure Jul 19 2012 JSX Optimizer 19