9 Commits

Author SHA1 Message Date
Jon Atkins
052d208783 increase latlng to guid cache size 2015-03-07 16:55:01 +00:00
eidyia
fe19227839 Eliminate CPU churning on cache highwater check
On older machines loading high portal dense areas this check is
using 70-90% of CPU in Object.keys(cache).length, leading to
resource starvation, and refresh times up to 10 times longer.

The LRU cache high-water mark is checked every time we receive portal
state from the intel servers to see if we need to do GC. In
my case this peaks out  500-1000 portal adds per second on
an aging laptop with the existing code with chrome-unstable,
and minimal IITC plugins.  GC itself (ignoring v8 GC) was only
taking 15ms, amortized to about 15usec a portal.

Unforutnately the Object.keys(cache).length check was taking
2-3ms each portal add, and 70-90% of the main thread was spent
there, grinding older machines to a halt.

I've just added a counter to track adds to the cache, and am
updating it with the real cache size on GC (the two checks
are almost always identical in higher density areas, and
won't lead to performance issues if cache adds are over-
estimated).

Effects:
 - pushPortalGuidPositionCache goes from using the majority
   of CPU when loading dense areas to almost nothing.

 - Older machines can actually view western europe without
   grinding the browser to a halt.

 - the cache itself is now hitting GC_LIMIT in less than
   100ms on my old laptop.  (I think increasing GC_LIMIT
   to 80,000 and GC_KEEP to 40,000 is going to put less
   load on the Javascript engine GC, and have the cache
   be useful still, but I left that out of the PR as it's
   slightly more subjective)

 - v8's GC is being slammed slightly less often than normal
   (it's still thrashing, but this isn't the main culprit)

The patch has been tested by about half a dozen people
using different blends of IITC plugins on both Chrome,
Firefox and across different OSs and with very different
hardware. Reports ranged from minor to (more often) huge
improvements in load speed and responsiveness in high
density areas.
2015-03-08 03:01:54 +11:00
fkloft
ad53f785d3 improve cache 2014-09-13 21:23:19 +02:00
fkloft
e9bd88fe31 implement latlng-to-guid cache 2014-09-13 20:55:40 +02:00
Jon Atkins
b595af30ad more work on fixing things for the 2014-05-23 changes
it's a big job - much is still broken
2014-05-23 23:50:37 +01:00
Jon Atkins
09af51a6e4 doh! daft bug
fixes #705
2013-12-17 17:05:21 +00:00
Jon Atkins
28b077b58d more portal summary data utility functions
- link/field count functions - useful when we only need numbers
- approximate AP gains, based only on summary data
2013-12-12 18:32:28 +00:00
Jon Atkins
3bfd83a0c2 method to attempt to find a portal lat/lng from guid, even if the portal data isn't available (we can also search through links and fields) - minimal testing
added note concerning unfinished/temporary nature of the portal details API
2013-12-01 15:18:44 +00:00
Jon Atkins
7a19d30173 first update of sidebar for new data format: show the info available from the brief portal data
TODO: retrieve the full portal data and update to include that
2013-11-30 22:26:40 +00:00