Five Java Features You Didnt Know About
summary
Five concrete JVM tricks and when they matter: the JIT uses stack allocation via escape analysis and inlining so temporary StringBuilder/String objects disappear after ~10k–50k iterations, cutting transient allocations to zero; microbenchmarks require warmup, blackhole/consumeCPU guards and JMH-like harnesses to avoid dead-code collapse; custom streams can short-circuit and be merged into SQL for O(1) paging; and large datasets run off-heap with ByteBuffer serializers and in-place aggregators to hold terabytes with minimal GC impact.
AI-written summary · about
chapters (27)
- 0:00Start
- 1:38Outline
- 2:01Allocate Local Objects on the Stack
- 2:30The Problem
- 5:00Allocate Objects on Stack Rather Than on Heap
- 6:15What Happened?
- 7:44Fast Facts: Stack Allocation
- 11:23Micro Benchmarks - JMH
- 13:57JMH Helps Controlling the Environment
- 15:41Consuming CPU - Blackhole Example
- 17:28Benchmark Code - Consume Results
- 18:09Benchmark Code - parallel
- 19:37Micro Benchmarks - Wrap Up
- 20:29Short-Circuit Java Streams
- 21:21Declarative Constructs
- 30:01Allocating Memory Off Heap
- 30:49ByteBuffer vs. Unsafe
- 32:19Read Performance Reading a Byte
- 32:50Consider Using ByteBuffer over Unsafe
- 37:05Speedment: DataStore
- 37:59Ultra-Low Latency for Terabytes of Data
- 38:21Ultra-Low Latency (Lower is Better)
- 39:42Solution: Off-Heap Maps
- 40:08Example - Average Salary per Age Group
- 41:37Speedment Aggregations with Expressions
- 41:55Speedment Aggregations Performance
- 43:26Speedment Aggregations from DataStore
related talks
53mJava Performance Update 2024
35mJava at Speed: Building a Better JVM
45mMinimal Values Under the Hood
44mJava at Speed: Building a Better JVM.
23mThe Java Features You’re Missing Out On
59mAn Introduction to JVM Performance
51mA Dozen Cool Things You can Do with JVM Languages
48mHidden Security Features of the JVM - Everything You Didn’t Know and More
