How difficult can it be to write efficient code?
summary
Uses AsyncProfiler, JMH and JFR to measure a string-prefix example: streams show ~9,900 allocation samples and a throughput score ~6k, a loop and string-builder approach moves scores toward ~12k. Benchmarks on Java 17 vs 21 change relative wins. Replaces three map lookups with a single-pass equals/hashCode comparison to avoid new strings, cutting startup ~5% on JVM and native image from 25ms to 17ms. Continuous measurement and environment changes matter.
AI-written summary · about
chapters (26)
- 0:00Efficient code writing
- 2:58Premature optimization myths
- 4:24Measuring performance
- 5:49Async-profiler for JVM
- 7:14Demo: string prefixing
- 10:42Parallel streams & StringBuilder
- 15:23Java Microbenchmark Harness
- 18:56Java version comparisons
- 21:50Environment impact on results
- 23:33Optimizing small examples?
- 23:57Quarkus config optimization
- 27:28Efficient env variable lookups
- 30:18HashCode & equals optimizations
- 32:05Backwards iteration for speed
- 33:33Continuous performance monitoring
- 34:59Performance regressions
- 35:40Memory allocation optimizations
- 36:23One Billion Row Challenge
- 37:47AI in performance optimization
- 38:31Simplicity vs syntactic sugar
- 39:12Optimization vs readability
- 40:38Avoiding optimization traps
- 41:00JVM updates impact
- 41:21Critical path analysis
- 41:42Learning from surprises
- 42:02Closing & Q&A
related talks
46mProfiling your Java Application A Beginner’s Guide
35mEasing the daily grind with the awesome JDK command line tools
58mEnhancing Java Applications for the Cloud
01h 02mJourney to Cloud : Leave No Java Workload Behind
19mScalable Coding—Find the Error
01h 01mImprove Java build performance with Gradle 5
50mPerformance: Avoiding Pitfalls, Diagnosing Issues & Scaling for Growth
01h 02mApplication Performance Optimisation in Practice
