~/talk

How to write fast Java code – thinking about memory

Talkat Jfokus 2023 · 2023-02-06..02-08· [java]
links:none on file
slides:none on file

A simple JMH matrix‑multiply benchmark runs six loop orders on 1000×1000 double matrices and shows loop order alone causes 24× difference in speed; hand‑refactoring for cache‑friendly access raises that to about 40× faster on a workstation. Splitting work across cores gives roughly ~10× speedup for eight cores (hyperthreading helps less), and combined tuning plus multithreading hits around 400× faster versus a naive order. Advice: use primitive arrays, avoid boxing/extra allocations, prefer cache‑local inner loops; compare to native BLAS (Intel MKL, Apple vecLib/Accelerate) for very large ops.

AI-written summary · about

  1. 0:00Start
  2. 0:47Matrix Multiplication
  3. 18:22CPU Cache Misses
  4. 42:44Optimise cache usage
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.