What is locality of reference?

This would not matter if your computer was filled with super-fast memory. But unfortunately that’s not the case and computer-memory looks something like this1: +———-+ | CPU | <<– Our beloved CPU, superfast and always hungry for more data. +———-+ |L1 – Cache| <<– ~4 CPU-cycles access latency (very fast), 2 loads/clock throughput +———-+ |L2 … Read more

Prevent caching of HTML page [duplicate]

The Codesnippet you showed makes the browser load the website everytime it accesses it, which is useful if you perform frequent updates, but still have a static page. <meta http-equiv=”Cache-Control” content=”no-cache, no-store, must-revalidate”/> <meta http-equiv=”Pragma” content=”no-cache”/> <meta http-equiv=”Expires” content=”0″/> In case you want it to perform live updates, like it does for example in a … Read more

Redis or Ehcache?

You can think Redis as a shared data structure, while Ehcache is a memory block storing serialized data objects. This is the main difference. Redis as a shared data structure means you can put some predefined data structure (such as String, List, Set etc) in one language and retrieve it in another language. This is … Read more

Temporal vs Spatial Locality with arrays

Spatial and temporal locality describe two different characteristics of how programs access data (or instructions). Wikipedia has a good article on locality of reference. A sequence of references is said to have spatial locality if things that are referenced close in time are also close in space (nearby memory addresses, nearby sectors on a disk, … Read more