SlideShare a Scribd company logo
JS compilation
    hot or not?




                  Zbigniew Braniecki (gandalf@mozilla.com)
let’s talk about benchmarks
5 categories of benchmarks
5 categories of benchmarks
•   Real applications
5 categories of benchmarks
•   Real applications
•   Modified applications
    (eg. with I/O removed to make it CPU-bound)
5 categories of benchmarks
•   Real applications
•   Modified applications
    (eg. with I/O removed to make it CPU-bound)

•   Kernels
    (key fragments of real applications)
5 categories of benchmarks
•   Real applications
•   Modified applications
    (eg. with I/O removed to make it CPU-bound)

•   Kernels
    (key fragments of real applications)

•   Toy benchmarks
    (eg. sieve of Erastosthenes)
5 categories of benchmarks
•   Real applications
•   Modified applications
    (eg. with I/O removed to make it CPU-bound)

•   Kernels
    (key fragments of real applications)

•   Toy benchmarks
    (eg. sieve of Erastosthenes)

•   Synthetic benchmarks
    (code created artificially to fit a profile of particular operations, e.g Dhrystone)
statistics
statistics

•   How common is average?
statistics

•   How common is average?

•   Biases (sampling, memory etc.)
statistics

•   How common is average?

•   Biases (sampling, memory etc.)

•   Measuring the right thing is hard
statistics

•   How common is average?

•   Biases (sampling, memory etc.)

•   Measuring the right thing is hard

•   Reducing complexity
History


How did browser JS performance improve over time
V8
V8

5000


3750


2500


1250


   0
       1.0   1.5   2.0   3.0    3.5   3.6   4   Nightly-JS
V8

5000


3750


2500


1250


   0
       1.0   1.5   2.0   3.0    3.5   3.6   4   Nightly-JS
V8

5000


3750


2500


1250


   0
       1.0   1.5   2.0   3.0    3.5   3.6   4   Nightly-JS
V8

5000


3750


2500


1250


   0
       1.0   1.5   2.0   3.0    3.5   3.6   4   Nightly-JS
V8

5000


3750


2500


1250


   0
       1.0   1.5   2.0   3.0    3.5   3.6   4   Nightly-JS
V8

5000


3750


2500


1250


   0
       1.0   1.5   2.0   3.0    3.5   3.6   4   Nightly-JS
V8

5000


3750


2500


1250


   0
       1.0   1.5   2.0   3.0    3.5   3.6   4   Nightly-JS
V8

5000


3750


2500


1250


   0
       1.0   1.5   2.0   3.0    3.5   3.6   4   Nightly-JS
V8

5000


3750


2500


1250


   0
       1.0   1.5   2.0   3.0    3.5   3.6   4   Nightly-JS
SunSpider
SunSpider

20000


15000


10000


 5000


    0
        1.0   1.5   2.0   3.0   3.5   3.6   4   Nightly-JS
SunSpider

20000


15000


10000


 5000


    0
        1.0   1.5   2.0   3.0   3.5   3.6   4   Nightly-JS
SunSpider

20000


15000


10000


 5000


    0
        1.0   1.5   2.0   3.0   3.5   3.6   4   Nightly-JS
SunSpider

20000


15000


10000


 5000


    0
        1.0   1.5   2.0   3.0   3.5   3.6   4   Nightly-JS
SunSpider

20000


15000


10000


 5000


    0
        1.0   1.5   2.0   3.0   3.5   3.6   4   Nightly-JS
SunSpider

20000


15000


10000


 5000


    0
        1.0   1.5   2.0   3.0   3.5   3.6   4   Nightly-JS
SunSpider

20000


15000


10000


 5000


    0
        1.0   1.5   2.0   3.0   3.5   3.6   4   Nightly-JS
SunSpider

20000


15000


10000


 5000


    0
        1.0   1.5   2.0   3.0   3.5   3.6   4   Nightly-JS
SunSpider

20000


15000


10000


 5000


    0
        1.0   1.5   2.0   3.0   3.5   3.6   4   Nightly-JS
SunSpider
SunSpider

3000


2250


1500


 750


   0
       3.0   3.5      3.6   4.0   Nightly-JS
SunSpider

3000


2250


1500


 750


   0
       3.0   3.5      3.6   4.0   Nightly-JS
SunSpider

3000


2250


1500


 750


   0
       3.0   3.5      3.6   4.0   Nightly-JS
SunSpider

3000


2250


1500


 750


   0
       3.0   3.5      3.6   4.0   Nightly-JS
SunSpider

3000


2250


1500


 750


   0
       3.0   3.5      3.6   4.0   Nightly-JS
SunSpider

3000


2250


1500


 750


   0
       3.0   3.5      3.6   4.0   Nightly-JS
Kraken
Kraken

50000


37500


25000


12500


    0
        3.0   3.5     3.6   4.0   Nightly-JS
Kraken

50000


37500


25000


12500


    0
        3.0   3.5     3.6   4.0   Nightly-JS
Kraken

50000


37500


25000


12500


    0
        3.0   3.5     3.6   4.0   Nightly-JS
Kraken

50000


37500


25000


12500


    0
        3.0   3.5     3.6   4.0   Nightly-JS
Kraken

50000


37500


25000


12500


    0
        3.0   3.5     3.6   4.0   Nightly-JS
Kraken

50000


37500


25000


12500


    0
        3.0   3.5     3.6   4.0   Nightly-JS
Types of JIT


method    vs.       tracing
method JIT
                 heap

     10
      9
      8
      7
      6
      5
      4
      3
      2
      1
      0
             a          b
method JIT
                 heap

     10
      9
      8
      7
      6
      5
      4
      3
      2
      1
      0
             a          b
method JIT
                 heap

     10
      9
      8
      7
      6
      5
      4
      3
      2
      1
      0
             a          b
method JIT
                 heap

     10
      9
      8
      7
      6
      5
      4
      3
      2
      1
      0
             a          b
method JIT
                 heap

     10
      9
      8
      7
      6
      5
      4
      3
      2
      1
      0
             a          b
method JIT
                 heap

     10
      9
      8
      7
      6
      5
      4
      3
      2
      1
      0
             a          b
method JIT
                     heap
hot loop!
            10
             9
             8
             7
             6
             5
             4
             3
             2
             1
             0
                 a          b
tracing JIT
              heap
  a
      10
       9
       8
       7
       6
       5
       4
       3
       2
       1
       0
                a
tracing JIT
                  heap
  b
      10
       9
       8
       7
       6
       5
       4
       3
       2
       1
       0
              a          b
tracing JIT
                      heap
         b
             10
              9
              8
              7
              6
              5
              4
              3
              2
              1
              0
hot trace!        a          b
How browsers compile stuff

•   Chakra (IE) - method

•   Carakan (Opera) - method

•   Nitro (Safari) - method

•   V8 (Chrome) - method

•   JägerMonkey (Firefox) - trace + method
method vs. tracing
How to help JIT
  hot loop!                b




                  hot trace!
What to avoid

•   competing heaps

•   variable type changing

•   evals

•   looong methods
Future

•   Dead code elimination

•   Type Interface

•   Function inlining

•   CrankShaft (Chrome) and IonMonkey (Firefox)
Questions?
Thank You!

More Related Content

Similar to Js compilation falsy values slides

Blind elephant black hat 2010 v2
Blind elephant   black hat 2010 v2Blind elephant   black hat 2010 v2
Blind elephant black hat 2010 v2
Jaime Restrepo
 
Scope of six sigma in indian foundry operations
Scope of six sigma in indian foundry operationsScope of six sigma in indian foundry operations
Scope of six sigma in indian foundry operations
Dr. Bikram Jit Singh
 
Tools for Metaspace
Tools for MetaspaceTools for Metaspace
Tools for Metaspace
Takahiro YAMADA
 
Awd3 m1 desi
Awd3 m1 desiAwd3 m1 desi
Awd3 m1 desi
Senistr0
 
mmsys2019 live streaming at scale
mmsys2019 live streaming at scalemmsys2019 live streaming at scale
mmsys2019 live streaming at scale
Jordi Cenzano
 
JKSimMet Course - Part 1
JKSimMet Course - Part 1JKSimMet Course - Part 1
JKSimMet Course - Part 1
James Didovich
 
working capital manegment
working capital manegmentworking capital manegment
working capital manegment
Gourav Priyadarshan
 
Physics Class 9th Chapter 1
Physics Class 9th Chapter 1Physics Class 9th Chapter 1
Physics Class 9th Chapter 1
MuhammadFaisal589
 
[2018 台灣人工智慧學校校友年會] 產業經驗分享: 如何用最少的訓練樣本,得到最好的深度學習影像分析結果,減少一半人力,提升一倍品質 / 李明達
[2018 台灣人工智慧學校校友年會] 產業經驗分享: 如何用最少的訓練樣本,得到最好的深度學習影像分析結果,減少一半人力,提升一倍品質 / 李明達[2018 台灣人工智慧學校校友年會] 產業經驗分享: 如何用最少的訓練樣本,得到最好的深度學習影像分析結果,減少一半人力,提升一倍品質 / 李明達
[2018 台灣人工智慧學校校友年會] 產業經驗分享: 如何用最少的訓練樣本,得到最好的深度學習影像分析結果,減少一半人力,提升一倍品質 / 李明達
台灣資料科學年會
 

Similar to Js compilation falsy values slides (9)

Blind elephant black hat 2010 v2
Blind elephant   black hat 2010 v2Blind elephant   black hat 2010 v2
Blind elephant black hat 2010 v2
 
Scope of six sigma in indian foundry operations
Scope of six sigma in indian foundry operationsScope of six sigma in indian foundry operations
Scope of six sigma in indian foundry operations
 
Tools for Metaspace
Tools for MetaspaceTools for Metaspace
Tools for Metaspace
 
Awd3 m1 desi
Awd3 m1 desiAwd3 m1 desi
Awd3 m1 desi
 
mmsys2019 live streaming at scale
mmsys2019 live streaming at scalemmsys2019 live streaming at scale
mmsys2019 live streaming at scale
 
JKSimMet Course - Part 1
JKSimMet Course - Part 1JKSimMet Course - Part 1
JKSimMet Course - Part 1
 
working capital manegment
working capital manegmentworking capital manegment
working capital manegment
 
Physics Class 9th Chapter 1
Physics Class 9th Chapter 1Physics Class 9th Chapter 1
Physics Class 9th Chapter 1
 
[2018 台灣人工智慧學校校友年會] 產業經驗分享: 如何用最少的訓練樣本,得到最好的深度學習影像分析結果,減少一半人力,提升一倍品質 / 李明達
[2018 台灣人工智慧學校校友年會] 產業經驗分享: 如何用最少的訓練樣本,得到最好的深度學習影像分析結果,減少一半人力,提升一倍品質 / 李明達[2018 台灣人工智慧學校校友年會] 產業經驗分享: 如何用最少的訓練樣本,得到最好的深度學習影像分析結果,減少一半人力,提升一倍品質 / 李明達
[2018 台灣人工智慧學校校友年會] 產業經驗分享: 如何用最少的訓練樣本,得到最好的深度學習影像分析結果,減少一半人力,提升一倍品質 / 李明達
 

Recently uploaded

PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
christinelarrosa
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
Fwdays
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
ScyllaDB
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
ScyllaDB
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
HarpalGohil4
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
leebarnesutopia
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
UiPathCommunity
 

Recently uploaded (20)

PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptxPRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
PRODUCT LISTING OPTIMIZATION PRESENTATION.pptx
 
"What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w..."What does it really mean for your system to be available, or how to define w...
"What does it really mean for your system to be available, or how to define w...
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
A Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's ArchitectureA Deep Dive into ScyllaDB's Architecture
A Deep Dive into ScyllaDB's Architecture
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Day 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio FundamentalsDay 2 - Intro to UiPath Studio Fundamentals
Day 2 - Intro to UiPath Studio Fundamentals
 

Js compilation falsy values slides

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. - heaps cost memory\n - compilation takes time\n
  54. - method - well known, tested\n - tracing - very new, Mozilla, LuaJIT and PyPy the first ones to try it out\n
  55. - fine tuning, compilation vs. time, compression vs. memory etc.\n
  56. - small functions\n - reduce branching\n - keep var types (int vs. float!)\n
  57. \n
  58. \n
  59. \n
  60. \n