Skip to content

Instantly share code, notes, and snippets.

View shukerullah's full-sized avatar
🎮
Busy

Pir Shukarullah Shah shukerullah

🎮
Busy
View GitHub Profile
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.
@mkhatib
mkhatib / geo.js
Created May 24, 2013 02:55
A Javascript utility function to generate number of random Geolocations around a center location and in a defined radius.
/**
* 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++) {