Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

#1BRC | @gunnarmorling The Goals Learn something new Have some fun along the way Inspire others to do the same

Slide 7

Slide 7 text

is slow?!

Slide 8

Slide 8 text

#1BRC | @gunnarmorling Is It Really a Problem, Though?

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

#1BRC | @gunnarmorling The Rules ● Java-only; Version of your choice ● No dependencies ● No caching ● 10K stations, -99.9°C - +99.9°C ● Copying allowed

Slide 11

Slide 11 text

#1BRC | @gunnarmorling Evaluation Environment ● 32 core AMD EPYC™ 7502P (Zen2), 8 Cores used ● 128 GB RAM ● File on RAM disk ● Five runs, slowest and fastest discarded Image © Joe Haupt https://flic.kr/p/2mG3vWA (CC BY-SA 2.0)

Slide 12

Slide 12 text

#1BRC | @gunnarmorling Baseline ⌛ 04:49.679

Slide 13

Slide 13 text

#1BRC | @gunnarmorling The First Submission Roy Van Rijn 🙌

Slide 14

Slide 14 text

Parallelization Ozzy Delaney https://flic.kr/p/pMsvzE (CC BY-SA 2.0 DEED)

Slide 15

Slide 15 text

#1BRC | @gunnarmorling Parallelization–Chunking the File We Have Cores Many

Slide 16

Slide 16 text

#1BRC | @gunnarmorling Parallelization ⌛ 71 sec.

Slide 17

Slide 17 text

#1BRC | @gunnarmorling JEP 454 Foreign Function & Memory API https://openjdk.org/jeps/454 Introduce an API by which Java programs can interoperate with code and data outside of the Java runtime. By efficiently invoking foreign functions (i.e., code outside the JVM), and by safely accessing foreign memory (i.e., memory not managed by the JVM), the API enables Java programs to call native libraries and process native data without the brittleness and danger of JNI.

Slide 18

Slide 18 text

#1BRC | @gunnarmorling Parallelization–Chunking the File

Slide 19

Slide 19 text

#1BRC | @gunnarmorling 1BRC Mythbusters

Slide 20

Slide 20 text

#1BRC | @gunnarmorling 1BRC—A Trivial Task?

Slide 21

Slide 21 text

Parsing jjmusgrove https://flic.kr/p/2mJbA8S (CC BY 2.0 DEED)

Slide 22

Slide 22 text

#1BRC | @gunnarmorling Parsing – Byte by Byte

Slide 23

Slide 23 text

#1BRC | @gunnarmorling Parsing – Byte by Byte ⌛ 20 sec.

Slide 24

Slide 24 text

#1BRC | @gunnarmorling Parsing – SIMD Single Instruction, Multiple Data https://speakerdeck.com/gunnarmorling/to-the-moon-and-beyond-with-java-17-apis

Slide 25

Slide 25 text

#1BRC | @gunnarmorling Parsing – SWAR SIMD Within a Register

Slide 26

Slide 26 text

#1BRC | @gunnarmorling Parsing Branchless Programming https://en.wikipedia.org/wiki/Branch_predictor

Slide 27

Slide 27 text

#1BRC | @gunnarmorling Don’t Try This At Home! Hacker’s Delight

Slide 28

Slide 28 text

#1BRC | @gunnarmorling And Then… Disaster Struck!

Slide 29

Slide 29 text

#1BRC | @gunnarmorling Standing On the Shoulders Of Giants

Slide 30

Slide 30 text

#1BRC | @gunnarmorling The 1BRC Community ● TCK ● Environment ● Evaluation Scripts

Slide 31

Slide 31 text

#1BRC | @gunnarmorling The 1BRC Community TCK, Evaluation Machine Set-Up, Scripting

Slide 32

Slide 32 text

Bookkeeping R. D. Barry https://flic.kr/p/P5RWWR (CC BY-SA 2.0 DEED)

Slide 33

Slide 33 text

#1BRC | @gunnarmorling Custom Maps – Linear Probing

Slide 34

Slide 34 text

#1BRC | @gunnarmorling Custom Maps – Hash Collisions!

Slide 35

Slide 35 text

#1BRC | @gunnarmorling JIT and AOT Compiler

Slide 36

Slide 36 text

#1BRC | @gunnarmorling Further Tricks & Techniques ● The “spawn trick” ● Unsafe ● Super-scalar execution ● Perfect value hashing

Slide 37

Slide 37 text

#1BRC | @gunnarmorling It’s 2024… Can We Have Some AI, Pretty Please?

Slide 38

Slide 38 text

The Results Clint Budd https://flic.kr/p/2m6F7hw (CC BY 2.0 DEED)

Slide 39

Slide 39 text

#1BRC | @gunnarmorling Results

Slide 40

Slide 40 text

#1BRC | @gunnarmorling Results – 32 Cores / 64 Threads

Slide 41

Slide 41 text

#1BRC | @gunnarmorling Results – 10K Key Set

Slide 42

Slide 42 text

#1BRC | @gunnarmorling It’s a Long Journey…

Slide 43

Slide 43 text

#1BRC | @gunnarmorling It’s a Long Journey… …Taken By a Community!

Slide 44

Slide 44 text

#1BRC | @gunnarmorling It’s a Long Journey…

Slide 45

Slide 45 text

#1BRC | @gunnarmorling Should You Do Any of This? It Depends

Slide 46

Slide 46 text

#1BRC | @gunnarmorling Getting the Basics Right Gets You Very Far CalculateAverage_MeanderingProgrammer.java

Slide 47

Slide 47 text

#1BRC | @gunnarmorling If You’re Building a Database Or Want To Get This Coffee Mug…

Slide 48

Slide 48 text

#1BRC | @gunnarmorling 1BRC—Distracting Developers Around the World 🤓

Slide 49

Slide 49 text

#1BRC | @gunnarmorling Show & Tell

Slide 50

Slide 50 text

#1BRC | @gunnarmorling Some Stats

Slide 51

Slide 51 text

#1BRC | @gunnarmorling Lessons Learned

Slide 52

Slide 52 text

#1BRC | @gunnarmorling Lessons Learned ● Precise rules, covering corner cases ● Automate, automate, automate ● Build a community ● Use dedicated hardware

Slide 53

Slide 53 text

is slow?

Slide 54

Slide 54 text

is slow? rocks!

Slide 55

Slide 55 text

#1BRC | @gunnarmorling What’s Next? ?

Slide 56

Slide 56 text

#1BRC | @gunnarmorling gunnar@decodable.co @gunnarmorling morling.dev 📧 Get In Touch

Slide 57

Slide 57 text

No content