Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Effectiveness and code optimization in Java
1. Effectiveness and code optimization
in Java
Sergey Morenets, sergey.morenets@gmail.com
December, 4 2015
2. About author
• Works in IT since 2000
• 12 year of Java SE/EE experience
• Regular speaker at Java conferences
• Author of “Development of Java applications” and “Main
errors in Java programming ”books
• Founder of http://it-simulator.com
7. Effectiveness
• Hard to determine on code/design review stages or in
unit-tests
• Is relevant for the specific project configuration
• Cannot be defined in development environment
• Depends on the application environment
• Premature optimization is evil
• Hardware-specific
• The only aspect of the ideal code that affects users
34. Measurements
• JMH is micro benchmarking framework
• Developed by Oracle engineers
• First release in 2013
• Requires build tool(Maven, Gradle)
• Can measure throughput or average time
• Includes warm-up period
74. Measurements
Type Time(ns)
Fill array (1000 elements) 148
Fill bit set(1000 elements) 1520
Fill array (50 000 elements) 4669
Fill bit set(50 000 elements) 71395
76. Measurements
Type Time(ns)
Fill array (1000 elements) 148
Fill bit set(1000 elements) 261
Fill array (50 000 elements) 4669
Fill bit set(50 000 elements) 12758