SlideShare a Scribd company logo
1 of 31
JAVA PERFORMANCE
IMPROVEMENTS
MYSTIC ARTSUKEN SHAH
SHINE EA
JAVA PERFORMANCE IMPROVEMENTS - DIMENSIONS
▸Fix Memory leaks
▸Fine tune Garbage collection
▸Improve ORM performance
▸ Fix Inefficient code
▸JIT and code cache
JIT OPTIMISATIONS - WTF?
DEMO
JIT - WHAT IS IT????
▸Dynamic compiler - Hotspot
▸Profile Guided Optimisation (PGO)
▸Aggressive optimisations
▸Tiered compilation mode
JIT - UNIT OF COMPILATION
▸Method
▸Loop
▸Hot methods
▸Hot loops
▸Warm methods and warm loops
JIT - HOT STUFF
-XX:+PRINTFLAGSFINAL
JIT - LIFE CYCLE
Interpreting
Profiling
Optimisation
De-optimisation
JIT - COMPILERS
C1 - CLIENT
COMPILER
▸ Fast acting compiler
▸ Invocation count > 2000
▸ 10x faster than interpreter
▸ Backendge count > 65000
C2 - SERVER
COMPILER
▸ Smart slow compiler
▸ Invocation count > 15000
▸ 2x faster than C1
▸ Backendge count > 40000
JIT - TIERED COMPILATION
0 3 4
0
0
2 3 4
3
Interpreter C1 C2
none counters details
1
preferred
C2 busy
Trivial
JIT OPTIMISATIONS - DEAD CODE, COMMON EXPRESSIONS
ELIMINATION
Dead code elimination
Common expression elimination
JIT OPTIMISATIONS - OSR (ON STACK REPLACEMENT)
For loop will be optimised by C1 compiler to level 3
JIT OPTIMISATIONS - LOOP PEELING
JIT OPTIMISATIONS - LOOP INVERSION
JIT OPTIMISATIONS - CODE MOTION, CONSTANT FOLDING
JIT OPTIMISATIONS - INTRINSICS
▸ Use hardware optimised compiled code
▸ System.arraycopy(), Math.sin() / cos() / tan(), System.currentMillis(),
Unsafe.compareAndSwapInt(), String.indexOf() /compareTo()/equals()
JIT OPTIMISATIONS - INLINING
JIT OPTIMISATIONS - CLASS HIERARCHY ANALYSIS & INLINING
Call site
A
PROCES
S()
A1
PROCES
S()
A2
PROCES
S()
SERVI
CE
JIT OPTIMISATIONS - CLASS HIERARCHY ANALYSIS & INLINING
FUNC
PLUS MINUS DIVIDE
Megamorphic
Inline till bimorphic scenario
Discovering new type leads to stop the
world deoptimisation
FUNC
PLUS
Monomorphic
Inline the method when
possible after CHA
Always has uncommon
trap for type.
JIT OPTIMISATIONS - CLASS HIERARCHY ANALYSIS & INLINING
DEMO
JIT OPTIMISATIONS - SPECULATIVE OPTIMISATIONS
▸Implicite null assertions
▸Type assertions
▸Untaken branch pruning
▸Optimistic megamorphic inline
JIT OPTIMISATIONS
JIT COMPILER LOGGING
▸Light logging
▸Full logging
▸Tools -> {JITWatch, jitwatch-intellij}
▸JMH Benchmark
JIT COMPILER LOGGING - LIGHT
-XX:+PRINTCOMPILATION
Time ID Flags Lvl Method Size
Flags -> b (blocking), s (static), n (native), % (OnStackReplacement), *
(Generating native wrapper), ! (found exception handler)
JIT COMPILER LOGGING - FULL
-XX:+UNLOCKDIAGNOSTICVMOPTIONS -XX:+LOGCOMPILATION -
XX:LOGFILE=<PATH_TO_LOG_FILE>
JIT COMPILER - MY OWN EFFORT
JIT OPTIMISATIONS - WHAT TO DO NEXT?
▸ Exhaust other options.
▸ Find out critical or most used code
paths
▸ Capture and analyse compilation logs
▸ Fix, test and measure performance
▸ Write good code (smaller methods,
unnecessary inheritance, make static
utilities)
JIT OPTIMISATIONS - WHAT IS JAVA DOING?
VS
JIT OPTIMISATIONS - WHAT IS JAVA DOING?
▸ JVMCI (JVM Compiler Interface)
http://openjdk.java.net/jeps/243
▸ Set of interfaces used by JVM to perform compilation.
▸ Use Java to write C1/C2 compilers.
▸ Project Graal http://openjdk.java.net/projects/graal/
#ThorRagnarok
JIT OPTIMISATIONS - WHAT IS JAVA DOING?
▸ AOT Compilation http://openjdk.java.net/jeps/295
#ThorRagnarok
▸ Java 9 is packed with jaotc tool.
▸ Restricted to Linux x64
JIT COMPILER - MORE INFO
Slides —> https://www.slideshare.net/SukenShah2/java-jit-compilers-
and-optimisations
Github —> https://github.com/suken/jit-reporter
LinkedIn —> https://www.linkedin.com/in/suken-shah-b805b937/
Email —> suken.3@gmail.com
THANK
YOU

More Related Content

What's hot

Android Developer Days: Increasing performance of big arrays processing on An...
Android Developer Days: Increasing performance of big arrays processing on An...Android Developer Days: Increasing performance of big arrays processing on An...
Android Developer Days: Increasing performance of big arrays processing on An...Stanfy
 
zkStudyClub: CirC and Compiling Programs to Circuits
zkStudyClub: CirC and Compiling Programs to CircuitszkStudyClub: CirC and Compiling Programs to Circuits
zkStudyClub: CirC and Compiling Programs to CircuitsAlex Pruden
 
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackup
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackupPLAM 2015 - Evolving Backups Strategy, Devploying pyxbackup
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackupJervin Real
 
Gdb tutorial-handout
Gdb tutorial-handoutGdb tutorial-handout
Gdb tutorial-handoutSuraj Kumar
 
Introduction to gdb
Introduction to gdbIntroduction to gdb
Introduction to gdbOwen Hsu
 
Crossing Abstraction Barriers When Debugging In Dynamic Languages
Crossing Abstraction Barriers When Debugging In Dynamic LanguagesCrossing Abstraction Barriers When Debugging In Dynamic Languages
Crossing Abstraction Barriers When Debugging In Dynamic LanguagesBastian Kruck
 
助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」
助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」
助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」Shinya Takamaeda-Y
 
Arm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler supportArm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler supportLinaro
 
An evaluation of LLVM compiler for SVE with fairly complicated loops
An evaluation of LLVM compiler for SVE with fairly complicated loopsAn evaluation of LLVM compiler for SVE with fairly complicated loops
An evaluation of LLVM compiler for SVE with fairly complicated loopsLinaro
 
State of JS Implementations, 2014 Edition (Web Engines Hackfest 2014)
State of JS Implementations, 2014 Edition (Web Engines Hackfest 2014)State of JS Implementations, 2014 Edition (Web Engines Hackfest 2014)
State of JS Implementations, 2014 Edition (Web Engines Hackfest 2014)Igalia
 
Autovectorization in llvm
Autovectorization in llvmAutovectorization in llvm
Autovectorization in llvmChangWoo Min
 
Assembly Language Tutorials for Windows - 05 Procedures Part 1
Assembly Language Tutorials for Windows - 05 Procedures Part 1Assembly Language Tutorials for Windows - 05 Procedures Part 1
Assembly Language Tutorials for Windows - 05 Procedures Part 1Sangram Kesari Ray
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxSignalFx
 
Probability of finding a single qubit in a state
Probability of finding a single qubit in a stateProbability of finding a single qubit in a state
Probability of finding a single qubit in a stateVijayananda Mohire
 

What's hot (20)

Android Developer Days: Increasing performance of big arrays processing on An...
Android Developer Days: Increasing performance of big arrays processing on An...Android Developer Days: Increasing performance of big arrays processing on An...
Android Developer Days: Increasing performance of big arrays processing on An...
 
zkStudyClub: CirC and Compiling Programs to Circuits
zkStudyClub: CirC and Compiling Programs to CircuitszkStudyClub: CirC and Compiling Programs to Circuits
zkStudyClub: CirC and Compiling Programs to Circuits
 
Vectorization in ATLAS
Vectorization in ATLASVectorization in ATLAS
Vectorization in ATLAS
 
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackup
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackupPLAM 2015 - Evolving Backups Strategy, Devploying pyxbackup
PLAM 2015 - Evolving Backups Strategy, Devploying pyxbackup
 
Usage of GDB
Usage of GDBUsage of GDB
Usage of GDB
 
Gdb tutorial-handout
Gdb tutorial-handoutGdb tutorial-handout
Gdb tutorial-handout
 
3 673 (1)
3 673 (1)3 673 (1)
3 673 (1)
 
Introduction to gdb
Introduction to gdbIntroduction to gdb
Introduction to gdb
 
Crossing Abstraction Barriers When Debugging In Dynamic Languages
Crossing Abstraction Barriers When Debugging In Dynamic LanguagesCrossing Abstraction Barriers When Debugging In Dynamic Languages
Crossing Abstraction Barriers When Debugging In Dynamic Languages
 
助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」
助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」
助教が吼える! 各界の若手研究者大集合「ハードウェアはやわらかい」
 
Arm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler supportArm tools and roadmap for SVE compiler support
Arm tools and roadmap for SVE compiler support
 
An evaluation of LLVM compiler for SVE with fairly complicated loops
An evaluation of LLVM compiler for SVE with fairly complicated loopsAn evaluation of LLVM compiler for SVE with fairly complicated loops
An evaluation of LLVM compiler for SVE with fairly complicated loops
 
pdb like a pro
pdb like a propdb like a pro
pdb like a pro
 
State of JS Implementations, 2014 Edition (Web Engines Hackfest 2014)
State of JS Implementations, 2014 Edition (Web Engines Hackfest 2014)State of JS Implementations, 2014 Edition (Web Engines Hackfest 2014)
State of JS Implementations, 2014 Edition (Web Engines Hackfest 2014)
 
Printf and scanf
Printf and scanfPrintf and scanf
Printf and scanf
 
Magma trcak b
Magma  trcak bMagma  trcak b
Magma trcak b
 
Autovectorization in llvm
Autovectorization in llvmAutovectorization in llvm
Autovectorization in llvm
 
Assembly Language Tutorials for Windows - 05 Procedures Part 1
Assembly Language Tutorials for Windows - 05 Procedures Part 1Assembly Language Tutorials for Windows - 05 Procedures Part 1
Assembly Language Tutorials for Windows - 05 Procedures Part 1
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFx
 
Probability of finding a single qubit in a state
Probability of finding a single qubit in a stateProbability of finding a single qubit in a state
Probability of finding a single qubit in a state
 

Similar to Java performance jit

Java Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey KovalenkoJava Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey KovalenkoValeriia Maliarenko
 
ReadyNow: Azul's Unconventional "AOT"
ReadyNow: Azul's Unconventional "AOT"ReadyNow: Azul's Unconventional "AOT"
ReadyNow: Azul's Unconventional "AOT"Doug Hawkins
 
A taste of GlobalISel
A taste of GlobalISelA taste of GlobalISel
A taste of GlobalISelIgalia
 
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideBKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideLinaro
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time OptimizationKan-Ru Chen
 
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...Akihiro Hayashi
 
May2010 hex-core-opt
May2010 hex-core-optMay2010 hex-core-opt
May2010 hex-core-optJeff Larkin
 
Slurm @ 2018 LabTech
Slurm @  2018 LabTechSlurm @  2018 LabTech
Slurm @ 2018 LabTechTin Ho
 
Introduction to JVM JIT Optimizations
Introduction to JVM JIT OptimizationsIntroduction to JVM JIT Optimizations
Introduction to JVM JIT Optimizationsdiegosoftware
 
Postgres Vision 2018: Making Postgres Even Faster
Postgres Vision 2018: Making Postgres Even FasterPostgres Vision 2018: Making Postgres Even Faster
Postgres Vision 2018: Making Postgres Even FasterEDB
 
Movable Type 5.2 Overview at MTDDC 2012
Movable Type 5.2 Overview at MTDDC 2012Movable Type 5.2 Overview at MTDDC 2012
Movable Type 5.2 Overview at MTDDC 2012Yuji Takayama
 
Accelerated Training of Transformer Models
Accelerated Training of Transformer ModelsAccelerated Training of Transformer Models
Accelerated Training of Transformer ModelsDatabricks
 
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time CompilationThe Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time CompilationMonica Beckwith
 
jcmd #javacasual
jcmd #javacasualjcmd #javacasual
jcmd #javacasualYuji Kubota
 
Compiler presention
Compiler presentionCompiler presention
Compiler presentionFaria Priya
 
PL-4044, OpenACC on AMD APUs and GPUs with the PGI Accelerator Compilers, by ...
PL-4044, OpenACC on AMD APUs and GPUs with the PGI Accelerator Compilers, by ...PL-4044, OpenACC on AMD APUs and GPUs with the PGI Accelerator Compilers, by ...
PL-4044, OpenACC on AMD APUs and GPUs with the PGI Accelerator Compilers, by ...AMD Developer Central
 
High Performance Erlang - Pitfalls and Solutions
High Performance Erlang - Pitfalls and SolutionsHigh Performance Erlang - Pitfalls and Solutions
High Performance Erlang - Pitfalls and SolutionsYinghai Lu
 
LAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android NLAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android NLinaro
 
Nvidia® cuda™ 5.0 Sample Evaluation Result Part 1
Nvidia® cuda™ 5.0 Sample Evaluation Result Part 1Nvidia® cuda™ 5.0 Sample Evaluation Result Part 1
Nvidia® cuda™ 5.0 Sample Evaluation Result Part 1Yukio Saito
 

Similar to Java performance jit (20)

Java Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey KovalenkoJava Jit. Compilation and optimization by Andrey Kovalenko
Java Jit. Compilation and optimization by Andrey Kovalenko
 
ReadyNow: Azul's Unconventional "AOT"
ReadyNow: Azul's Unconventional "AOT"ReadyNow: Azul's Unconventional "AOT"
ReadyNow: Azul's Unconventional "AOT"
 
A taste of GlobalISel
A taste of GlobalISelA taste of GlobalISel
A taste of GlobalISel
 
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideBKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
 
May2010 hex-core-opt
May2010 hex-core-optMay2010 hex-core-opt
May2010 hex-core-opt
 
Slurm @ 2018 LabTech
Slurm @  2018 LabTechSlurm @  2018 LabTech
Slurm @ 2018 LabTech
 
Introduction to JVM JIT Optimizations
Introduction to JVM JIT OptimizationsIntroduction to JVM JIT Optimizations
Introduction to JVM JIT Optimizations
 
Postgres Vision 2018: Making Postgres Even Faster
Postgres Vision 2018: Making Postgres Even FasterPostgres Vision 2018: Making Postgres Even Faster
Postgres Vision 2018: Making Postgres Even Faster
 
Movable Type 5.2 Overview at MTDDC 2012
Movable Type 5.2 Overview at MTDDC 2012Movable Type 5.2 Overview at MTDDC 2012
Movable Type 5.2 Overview at MTDDC 2012
 
Accelerated Training of Transformer Models
Accelerated Training of Transformer ModelsAccelerated Training of Transformer Models
Accelerated Training of Transformer Models
 
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time CompilationThe Performance Engineer's Guide To HotSpot Just-in-Time Compilation
The Performance Engineer's Guide To HotSpot Just-in-Time Compilation
 
jcmd #javacasual
jcmd #javacasualjcmd #javacasual
jcmd #javacasual
 
Compiler presention
Compiler presentionCompiler presention
Compiler presention
 
PL-4044, OpenACC on AMD APUs and GPUs with the PGI Accelerator Compilers, by ...
PL-4044, OpenACC on AMD APUs and GPUs with the PGI Accelerator Compilers, by ...PL-4044, OpenACC on AMD APUs and GPUs with the PGI Accelerator Compilers, by ...
PL-4044, OpenACC on AMD APUs and GPUs with the PGI Accelerator Compilers, by ...
 
High Performance Erlang - Pitfalls and Solutions
High Performance Erlang - Pitfalls and SolutionsHigh Performance Erlang - Pitfalls and Solutions
High Performance Erlang - Pitfalls and Solutions
 
LAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android NLAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android N
 
Programar para GPUs
Programar para GPUsProgramar para GPUs
Programar para GPUs
 
Nvidia® cuda™ 5.0 Sample Evaluation Result Part 1
Nvidia® cuda™ 5.0 Sample Evaluation Result Part 1Nvidia® cuda™ 5.0 Sample Evaluation Result Part 1
Nvidia® cuda™ 5.0 Sample Evaluation Result Part 1
 

Recently uploaded

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 

Recently uploaded (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 

Java performance jit

  • 2. JAVA PERFORMANCE IMPROVEMENTS - DIMENSIONS ▸Fix Memory leaks ▸Fine tune Garbage collection ▸Improve ORM performance ▸ Fix Inefficient code ▸JIT and code cache
  • 4. JIT - WHAT IS IT???? ▸Dynamic compiler - Hotspot ▸Profile Guided Optimisation (PGO) ▸Aggressive optimisations ▸Tiered compilation mode
  • 5. JIT - UNIT OF COMPILATION ▸Method ▸Loop ▸Hot methods ▸Hot loops ▸Warm methods and warm loops
  • 6. JIT - HOT STUFF -XX:+PRINTFLAGSFINAL
  • 7. JIT - LIFE CYCLE Interpreting Profiling Optimisation De-optimisation
  • 8. JIT - COMPILERS C1 - CLIENT COMPILER ▸ Fast acting compiler ▸ Invocation count > 2000 ▸ 10x faster than interpreter ▸ Backendge count > 65000 C2 - SERVER COMPILER ▸ Smart slow compiler ▸ Invocation count > 15000 ▸ 2x faster than C1 ▸ Backendge count > 40000
  • 9. JIT - TIERED COMPILATION 0 3 4 0 0 2 3 4 3 Interpreter C1 C2 none counters details 1 preferred C2 busy Trivial
  • 10. JIT OPTIMISATIONS - DEAD CODE, COMMON EXPRESSIONS ELIMINATION Dead code elimination Common expression elimination
  • 11. JIT OPTIMISATIONS - OSR (ON STACK REPLACEMENT) For loop will be optimised by C1 compiler to level 3
  • 12. JIT OPTIMISATIONS - LOOP PEELING
  • 13. JIT OPTIMISATIONS - LOOP INVERSION
  • 14. JIT OPTIMISATIONS - CODE MOTION, CONSTANT FOLDING
  • 15. JIT OPTIMISATIONS - INTRINSICS ▸ Use hardware optimised compiled code ▸ System.arraycopy(), Math.sin() / cos() / tan(), System.currentMillis(), Unsafe.compareAndSwapInt(), String.indexOf() /compareTo()/equals()
  • 17. JIT OPTIMISATIONS - CLASS HIERARCHY ANALYSIS & INLINING Call site A PROCES S() A1 PROCES S() A2 PROCES S() SERVI CE
  • 18. JIT OPTIMISATIONS - CLASS HIERARCHY ANALYSIS & INLINING FUNC PLUS MINUS DIVIDE Megamorphic Inline till bimorphic scenario Discovering new type leads to stop the world deoptimisation FUNC PLUS Monomorphic Inline the method when possible after CHA Always has uncommon trap for type.
  • 19. JIT OPTIMISATIONS - CLASS HIERARCHY ANALYSIS & INLINING DEMO
  • 20. JIT OPTIMISATIONS - SPECULATIVE OPTIMISATIONS ▸Implicite null assertions ▸Type assertions ▸Untaken branch pruning ▸Optimistic megamorphic inline
  • 22. JIT COMPILER LOGGING ▸Light logging ▸Full logging ▸Tools -> {JITWatch, jitwatch-intellij} ▸JMH Benchmark
  • 23. JIT COMPILER LOGGING - LIGHT -XX:+PRINTCOMPILATION Time ID Flags Lvl Method Size Flags -> b (blocking), s (static), n (native), % (OnStackReplacement), * (Generating native wrapper), ! (found exception handler)
  • 24. JIT COMPILER LOGGING - FULL -XX:+UNLOCKDIAGNOSTICVMOPTIONS -XX:+LOGCOMPILATION - XX:LOGFILE=<PATH_TO_LOG_FILE>
  • 25. JIT COMPILER - MY OWN EFFORT
  • 26. JIT OPTIMISATIONS - WHAT TO DO NEXT? ▸ Exhaust other options. ▸ Find out critical or most used code paths ▸ Capture and analyse compilation logs ▸ Fix, test and measure performance ▸ Write good code (smaller methods, unnecessary inheritance, make static utilities)
  • 27. JIT OPTIMISATIONS - WHAT IS JAVA DOING? VS
  • 28. JIT OPTIMISATIONS - WHAT IS JAVA DOING? ▸ JVMCI (JVM Compiler Interface) http://openjdk.java.net/jeps/243 ▸ Set of interfaces used by JVM to perform compilation. ▸ Use Java to write C1/C2 compilers. ▸ Project Graal http://openjdk.java.net/projects/graal/ #ThorRagnarok
  • 29. JIT OPTIMISATIONS - WHAT IS JAVA DOING? ▸ AOT Compilation http://openjdk.java.net/jeps/295 #ThorRagnarok ▸ Java 9 is packed with jaotc tool. ▸ Restricted to Linux x64
  • 30. JIT COMPILER - MORE INFO Slides —> https://www.slideshare.net/SukenShah2/java-jit-compilers- and-optimisations Github —> https://github.com/suken/jit-reporter LinkedIn —> https://www.linkedin.com/in/suken-shah-b805b937/ Email —> suken.3@gmail.com

Editor's Notes

  1. Dynamic compilation means that the compilation happens at runtime along side program execution Captures data about code
  2. invocation counters and backendge counters
  3. Max Inline size for not hot methods = 35 bytes (250 invocations) Max Inline size for hot hot methods is 325 bytes, max inline level = 9, recursion = 1. Inline small methods. (max size = 325 bytes, max inline level = 9, recursion = 1) static, private and constructor calls.
  4. Explain call sites. Monomorphic, biomorphic and metamorphic. Sets uncommon trap. Abstract class - deoptimsation if new type is discovered Interfaces - no deoptimization is performed
  5. Explain call sites. Monomorphic, biomorphic and metamorphic. Sets uncommon trap. Abstract class - deoptimsation if new type is discovered Interfaces - no deoptimization is performed
  6. Adds implicit null checks when required (only after observing > 3 NPE) Adds implicit type assertions (monomorphic inline) Set uncommon traps for untaken branches of code. As explained earlier slide.
  7. JMH benchmarks are like junit tests but has its own annotations to force compilers to do inlining, measuring benchmark.
  8. Write dynamic compilers faster with Java. Better code quality, extensible and quick to develop.
  9. Ahead Of Time compilation can be used to compile some modules of java and/or your code as part of your builds avoiding runtime compilation. Its an experimental feature. It cannot replace c2 compile code as it doesn’t have any profile data. So no speculative optimisations.