* Moves converter pattern to Java 11 * Moves cqrs pattern to Java 11 * Moves dao pattern to Java 11 * Moves data-bus pattern to Java 11 * Moves data-locality pattern to Java 11 * Moves data-mapper pattern to Java 11 * Moves data-transfer-object pattern to Java 11 * Moves decorator pattern to Java 11 * Moves delegation pattern to Java 11 * Moves dependency-injection to Java 11 * Moves dirty-flag to Java 11 * Moves double-buffer to Java 11 * Moves double-checked-locking to Java 11 * Moves double-dispatch to Java 11 * Corrects with changes thats breaking test cases
layout, title, folder, permalink, categories, tags
layout | title | folder | permalink | categories | tags | ||
---|---|---|---|---|---|---|---|
pattern | Data Locality | data-locality | /patterns/data-locality/ | Behavioral |
|
Intent
Accelerate memory access by arranging data to take advantage of CPU caching.
Modern CPUs have caches to speed up memory access. These can access memory adjacent to recently accessed memory much quicker. Take advantage of that to improve performance by increasing data locality keeping data in contiguous memory in the order that you process it.
Class diagram
Applicability
- Like most optimizations, the first guideline for using the Data Locality pattern is when you have a performance problem.
- With this pattern specifically, you’ll also want to be sure your performance problems are caused by cache misses.
Real world example
- The Artemis game engine is one of the first and better-known frameworks that uses simple IDs for game entities.