Collection slow to load

  • Hi


    I'm seeing an issue where the images from a collection is loading in slowly.


    I've got a collection setup for a portfolio section with the following template (portfolio_full.html);



    With the function on portfolio.php page;


    PHP
    1. <?php
    2. perch_collection('portfolio', [
    3. 'count' => 20,
    4. 'sort-order' => 'DESC',
    5. 'template'=>'portfolio_list.html',
    6. ]);
    7. ?>

    Then, the function;


    PHP
    1. <?php
    2. perch_collection('portfolio', [
    3. 'template'=>'portfolio_full.html',
    4. 'filter' => 'portfolio_slug',
    5. 'match' => 'eq',
    6. 'count' => 1,
    7. 'value' => perch_get('s'),
    8. ]);
    9. ?>

    on the portfolio_full.php page which calls the first template (portfolio_full.html)


    All is working great, expect the images take about 10seconds to load in. I've even created a preloader div that fades when the window is loaded, but it still fades before the images come through, so I don't think its an image file-size issue.


    The debug from the page is;



    And the diagnostics are;


  • drewm

    Approved the thread.
  • Thanks Drew. I'll try moving the no-index is see if that helps. How do you mean how big is your index? Do you mean how many items in the collection.


    ps. Sorry about the late reply. I didn't receive an email notification about the update. Is this not automatic on the new forum?


    Edit - Just noticed the no-index parts were added twice (once in the right place and once in the wrong place). I have removed the wrong ones with the same result.

  • You say it takes a long time, but your debug disagrees:


    Code
    1. Process time: 0.0427


    0.04 seconds is the sort of build time you'd expect for a page. Have you looked in your browser dev tools to see where the slowness might be coming from?

  • Code
    1. Process time: 0.0427

    Yeah, I thought that when I saw it. I've done a quick video to show whats happening. The text pops in, then images pop in later.


    I had a look in dev tools to see whats happening, but I'll take a closer look.


    Video


    Edit - I've just tried looking in Chrome dev tools and the images don't load at all the first time (do after a refresh), so I must have something really wrong... I will keep looking.