1B Rows with the Memory API - JEP Cafe #25 @java
1B Rows with the Memory API - JEP Cafe #25  @java
Uploaded January 2026 | Updated November 2026, 2 days ago
In this JEP Café episode, we take on the well-known '1 Billion Rows Challenge' and implement it using the standard Memory API introduced in JDK 22. The goal of this implementation is not to break any speed records, but to show you how one can process binary data using standard patterns offered by the JDK, in a clean and efficient way.
You will see how the different elements of the Memory API are working together. First, you will see which Arena implementation to choose from, among the four given to you by the API. Then you will create Memory Segments to map your multi gigabytes file in the off-heap memory. And then, you will define MemoryLayouts to describe their content in a structured way. Lastly, you will use VarHandles and parallel streams to access and process this data. You see how fast you can go with these clean and standard patterns, that you can use in your own application.

Come to *JavaOne 2026* in Redwood City, March 17th-19th, and get *50$ off with code J12026YTLFV* : oracle.com/javaone

You can watch all the episodes on the JEP Café series here: youtube.com/playlist?list=PLX8CzqL3ArzV4BpOzLanxd4bZr46x5e87

00:00 Intro
02:55 Writing and reading to the off-heap memory
05:30 Getting the global Arena, and creating an auto Arena
09:36 Creating and closing shared and confined Arenas
11:06 Using Arenas to allocate Memory Segments
11:50 Creating heap Memory Segments on arrays or by slicing other Memory Segments
12:59 Creating Memory Layouts
14:23 Aligning primitive elements with padding
16:53 Creating VarHandles from MemoryLayouts
18:58 Writing and reading data using arenas, memory segments, and var handles
19:49 Writing and reading arrays using specific var handles
21:36 Avoiding boxing and un boxing with VarHandles and exact invocation
23:09 Mapping files to off-heap memory segments
24:59 Creating the test file with 1 billion rows
25:38 Reading the data from the test file with the Stream API
29:08 Running the final benchmark and getting the result
31:10 That's it for today, talk to you soon!

⎯⎯⎯⎯⎯⎯ Resources ⎯⎯⎯⎯⎯⎯

◦ Gunnar Morling initial blog post ➱ https://www.morling.dev/blog/one-billion-row-challenge/
◦ 1BRC - The results are in by Gunnar Morling ➱ https://www.morling.dev/blog/1brc-results-are-in/
◦ 1 billion row challenge GitHub repo ➱ github.com/gunnarmorling/1brc
◦ JEP 454: Foreign Function & Memory API ➱ openjdk.org/jeps/454
◦ Dev.java ➱ https://dev.java
◦ Inside.java ➱ https://inside.java
◦ JDK 25 ➱ openjdk.org/projects/jdk/25
◦ JDK 26 ➱ openjdk.org/projects/jdk/25
◦ OpenJDK ➱ openjdk.org
◦ Oracle Java ➱ oracle.com/java
1B Rows with the Memory API - JEP Cafe #25What is a Memory Layout? - Cracking the Java Coding Interview #javalanguage #javacoding #javatipsWhat is Context Switching? - Cracking the Java Coding Interview #javacoding #javatipsWhat are suppressed exceptions? - Cracking the Java Coding Interview #javalanguage #javatipsTheres Still Time To Participate In Modern Java in the Wild ! 🚀How can you generate predictable Random numbers? #javalanguage #javacoding #javatipsPost-Mortem JVM Crash Analysis with jcmdNever tell Duke the odds! 🙅‍♂️What does the Object.wait() method do?  - Cracking the Java Coding Interview #javacoding #javatipsHow can you gather statistics on a Stream?  Cracking the Java Coding Interview #javacoding #javatipsWhat is an EnumMap? - Cracking the Java Coding Interview #javalanguage #javacoding #javatipsUnboxing Java 26 for Developers - Inside Java Newscast #108
Java |

1B Rows with the Memory API - JEP Cafe #25

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER