dylanfprice / angular-gm

AngularJS Google Maps Directives
MIT License
198 stars 47 forks source link

Performance issues #70

Closed thany closed 9 years ago

thany commented 9 years ago

This produces a veeeery slow map on Firefox 32. Panning is incredibly sluggish at usually less than 2fps. Zooming appears to perform okay-ish. HWA is enabled, but even had it been disabled, it wouldn't be causing this much of a slow-down.

I've also tested on Opera 12, which is usually the slower browser, but in this case it's actually a lot snappier, panning at what looks like 15-ish fps, even though zooming is around 4fps. Isn't that something.

Using Anugular 1.3.0, jQuery 2.1.1 and AngularGM 1.0.0.

thany commented 9 years ago

Is there a way to use the classic maps style? The not-modern one? Because mainly the classic version seems to perform about a billion times better in Firefox. And by classic, I mean the kind that makes the map look like this: capture

Notice the controls that are different, and the map having slightly better contrast as well (or I need sleep :P). Other than that, once loaded, a lot smoother. Unless it needs to load something again, but that part is Google's fault (probably hauling in resources synchronously, gha!)

thany commented 9 years ago

It appears panning the map around needs a debounced event handler. I assume it's hooked up with some kind of event handler, ultimately. Here's an example debounce that might work. The idea is not to call the event handler more often than X times per second.

My reasoning for this is that panning the map slowly (very slowly, almost pixel-by-pixel) doesn't make things go sluggish and jerky. Ony panning around quickly is sluggish and jerky.

And did I mention that Firefox consumes 100% CPU (on a single core) while panning the map? That's another nail in the coffin for some kind of event handler code being called way too often.

dylanfprice commented 9 years ago

Looks like you are having multiple issues with Firefox 32. I will try to repro when I get a chance and you are probably right about debouncing the handler.

thany commented 9 years ago

In the mean time, my Firefox has upgraded itself to 33.1, and the problems aren't as bad anymore. But even so, debouncing to support slower browsers/computers wouldn't hurt ;)

dylanfprice commented 9 years ago

Removed an event handler and added debouncing in gmMap: 05cb5ff