This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In general, a cache is a "more local" copy of a memory resource that you want to access. | |
Its a copy that is faster to access than the original, but that memory is also more expensive. | |
This link, provides some measurements that illustrate the benefits: http://norvig.com/21-days.html#answers | |
Disk cache is RAM memory, that contains a copy of the information on the disk. | |
Typically, when you access something on the drive, the whole page is brought into cache, on the assumption that the next access will be in that page. | |
The first disk seek might take 8ms, while seeks from cache 100 ns (many times faster - note nanoseconds instead of milliseconds) | |
Memory cache is the same concept, but the cache is located on the CPU chip. So the original memory access is 100ns, the L1 cache access can be 0.5 ns. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generates number of random geolocation points given a center and a radius. | |
* @param {Object} center A JS object with lat and lng attributes. | |
* @param {number} radius Radius in meters. | |
* @param {number} count Number of points to generate. | |
* @return {array} Array of Objects with lat and lng attributes. | |
*/ | |
function generateRandomPoints(center, radius, count) { | |
var points = []; | |
for (var i=0; i<count; i++) { |