Support » Plugin: Maps Builder - Google Maps Plugin » Slow load of pages without maps

  • Resolved tlhackque

    (@tlhackque)


    google maps builder includes all the overhead (CSS, scripts, prefetch links, etc) for a map even when none is present on a page. This slows the loading of such pages.

    In the referenced site, there is only one page with a map. Yet every page loads the overhead. This changes load time of the home page (which doesn’t have a map) from under 1 sec to about 5.5 sec – the last thing being a call to maps.googleapis.com/maps/api/js/AuthenticationService.Authenticate.

    Experimentally, I disabled the plugin – yet the overhead still loads.

    You can see this with any browser – just view page source and/or use the developer’s network view.

    Bottom line: the map overhead should only be included in pages that include a [google_maps] token.

    Also note – the page with a map from this plugin isn’t currently public. The public map (also not on the home page) is generated by different plugin. However, the slowdown was noted when google-maps-builder was added to the site.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matt Cromwell

    (@webdevmattcrom)

    HI there,

    Yes that’s true that scripts and styles are loaded globally. We made that decision largely because of caching plugins. They can often cache your scripts/styles WITHOUT the ones that our plugin loads conditionally and end up wrecking your pages with our maps on them.

    Generally speaking though, the slowdown you mention should be minimal or next to nothing. If it is significant, then most likely there are other JS erros creating the problem.

    If you can point me to a page on your site where you are using our maps plugin I can take a closer look and have suggestions.

    Thanks!

    Thread Starter tlhackque

    (@tlhackque)

    Thanks for responding.

    You are correct in saying that inexpert use of a caching plugin can cause confusion. But I don’t agree that the solution is to have your plugin tax the whole site.

    The home page, listed above, ends up calling the authentication service despite having no maps.

    The issue is not so much the fact that the scripts load, but rather that they the google APIs then call services like AuthentcationService.Authenicate, which more than double the page load time. Even though the page renders before the call, the browser shows “busy” – and so do site performance monitors. There’s no free lunch – if a page has a map, that’s fine. But taxing all the others is painful.

    This page – https://andreasvonhuene.com/upcoming-presentation/ – has one of your maps. In this case, the outlier is QuotaService.RecordEvent – about 6-8 seconds. The rest of the page loads in 1-3 seconds (depending on cache states).

    FYI: The other map plugin is used on https://andreasvonhuene.com/see-own/map/. It has similar issues (being worked).

    I use chrome (incognito)’s network panel (from F12) for timing.

    I do have a caching plugin on the site – TotalCache. And for the reasons you noted, I exclude pages with maps.

    Your strategy prevents the cache plugin (or admin) from making the right choice – you force every page on the site to carry the overhead, even if just 1 (or even -e.g. temporarily – none) has a map.

    This is a particular issue for home/landing pages – visitor’s first impression matters. So I try for lightweight pages there – if there’s interest, most visitors will tolerate a slightly longer load time for the second page. And certainly when a map is requested.

    I could live with having to manually identify pages with maps – perhaps a plugin option “include map scripts on: all_pages, pages_with_maps”. Or “include map scripts on: ()all pages [these pages]”.

    Most of the reasons for creating combo pages for caching disappear with http/2 – which is finally gaining traction…

    Thanks for your time.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Slow load of pages without maps’ is closed to new replies.