Data Locality pattern #559 (#889)

* Data Locality pattern #559

* Fixed review comments

* updated pom

* Fixed failed build
This commit is contained in:
Ranjeet
2019-09-30 20:49:08 +05:30
committed by Ilkka Seppälä
parent 5f39f7fbf7
commit 6b297b701f
13 changed files with 633 additions and 0 deletions

30
data-locality/README.md Normal file
View File

@ -0,0 +1,30 @@
---
layout: pattern
title: Data Locality
folder: data-locality
permalink: /patterns/data-locality/
categories: Other
tags:
- Java
- Difficulty-Intermediate
- Performance
---
## 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.
## Applicability
* Like most optimizations, the first guideline for using the Data Locality pattern is when you have a performance problem.
* With this pattern specifically, youll also want to be sure your performance problems are caused by cache misses.
## Real world example
* The [Artemis](http://gamadu.com/artemis/) game engine is one of the first and better-known frameworks that uses simple IDs for game entities.
## Credits
* [Game Programming Patterns Optimization Patterns: Data Locality](http://gameprogrammingpatterns.com/data-locality.html)