We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17016
    • 138 Posts
    &cacheResults is per default = 1 Therefore we didn´t defined this parameter in the snippet-call. But maybe there are more parameters which influence the speed of wayfinder?
      • 33968
      • 863 Posts
      Another thing - does it take the 2.5s on every load (from cache)? Or just the first load?

      I have some snippets which take several seconds to execute on first run, but I know that after that they will be viewed from the cache in a split second. I just make sure to load that page myself when the cache is cleared so that a site visitor doesn’t take the performance hit. Sometimes that’s the (small) price you have to pay when you push things to the limit.

      Otherwise look into building a custom snippet that is optimised for what you are trying to do smiley

      Note: I had a look in wayfinder.class.php and couldn’t find that code. Perhaps the fix has been implemented already.
        • 17016
        • 138 Posts
        Now I did live-tests in our original website:

        Execution-Time of wayfinder (including 212 menu-items) cached is 1.4 s
        Execution-Time of wayfinder (including 212 menu-items) uncached is 2.5 s

        Is there any chance to reduce this time of the cached wayfinder (1.4 s)? At the moment the time from browser-connect to our website till sending the first byte to the browser is 2.4 s which is mainly caused by wayfinder. Therefore it would be great if we could speed up wayfinder a little bit...

        Letti


          • 33968
          • 863 Posts
          It’s very strange that it is so slow to load from the cache. I’ve built a 160 item menu in Evo with Wayfinder and it loads in something like 0.05 seconds from the cache.

          Open up your home page resource and click the ’Page Settings’ tab. Is the page itself set to ’cacheable’?

          Is it possible to send a link to the live site?

          Another option that has worked for others is to create a plugin that runs Wayfinder whenever a page is created or saved, then outputs the menu as static html into a chunk.
          Have a look here (but note that the plugin is coded for Evo):
          http://modxcms.com/forums/index.php/topic,22068.msg136560.html#msg136560
            • 34178
            • 212 Posts
            I am not sure if Shaun McCormick as the author of wayfinder is reading this thread, too. But if yes, is it possible to implement a parameter to protect wayfinder from clear cash on saving a resource?
            For example:

            [[Wayfinder? &protectcacheonsave=`1`]] 


            The reason why I ask this is: On our website (> 1.000 webpages) creating the menu by wayfinder takes about 2-3 seconds (in cached status it takes far less than one second). When we make a little correction on one single page (e. g. correct a misspelled word/add a question mark in a sentence ...) and save this page afterwards the reload of all our > 1.000 webpages took very long for the first visitor because of creating the menu again by wayfinder what is definitely not necessary because we didn´t change any part of the menu.

            Do you therefore think it is possible to implement a parameter to the wayfinder-call which will avoid to clear the cached menu on saving a single page? By implementing such a new parameter the cached menu will only be cleared by manually clicking on 'clear cache'.

            What do you think of such an additional parameter?

            Thanks again for your great work on modx ...
            Letti
              • 33968
              • 863 Posts
              Lettis - adding that parameter will make no difference at all as the snippet is only run on front end pages. The cache refresh is fired from within the manager when you save a resource - that is when this would have any effect.

              The simplest option for you would be to save the Wayfinder output to a chunk when saving as discussed in this thread:
              https://forums.modx.com/thread/39979/wayfinder-slowness-issue?page=3#dis-post-413494

              You will however be adding the time taken to generate the menu to the time it takes to save a page in the manager, so it will be your choice: slow for site visitors, or slow for manager users.

              I've just updated the code to Revo.