Body: <p>I am having trouble pinpointing the issue but I am struggling with some of my pages taking an absolute age to load. For example;  </p>
  
  <p><img src="https://i.sstatic.net/hcnGJ.png" alt="Slow loading example"> 
  <img src="https://i.sstatic.net/SNvC3.png" alt="Slow loading example"> 
  It might be a local MAMP issue, but some pages load fine and I would say these pages seem to load very slowly each time.</p>
  
  <p>it could be related to the imager plugin (generating lots of images (srcset and sizes) but I expect this only to run in the first instance not each time. When I look in my folders (in dropbox) I can see the folders get updated by not each image file. </p>
  
  <p>Or it could be my code and queries and setup, in particular Eager-loading.
  I am struggling to get my head around this and I have so far been unable to reduce the amount of queries, this also varies on each load from between 107ish to 115ish.</p>
  
  <p>Here is my code for this particular section. I do have related categories and images for each entry which I believe would benefit from Eager Loading, but I cannot establish if my code is correct for the eager loading?</p>
  
  <pre><code>&lt;div class="container"&gt;
      {% set categories = craft.categories.group('cables') %}
      {% set cables = craft.entries({
              section: 'cables',
              with: [
                  'cableCategory',
                  'cableImage',
              ],
              order:  'title'
      }) %}
  
      {% for category in categories.relatedTo(cables) %}
      &lt;div class="cableGroup"&gt;
          &lt;h2 class="panel__title"&gt;{{ category }}&lt;/h2&gt;
          &lt;div class="cableGroup__description content // margin-bottomX2"&gt;
              {{ category.description }}
          &lt;/div&gt;
  
          &lt;ul&gt;
              {% for cable in cables.relatedTo(category) %}
              {% set image = cable.cableImage[0] ?? null %}
              &lt;li class="cable"&gt;
                  &lt;a href="#{{ cable.title|camel|upper }}" data-title="{{ cable.title }} &amp;#xa;"&gt;
                      {% if image|length %}
                      {{ img.imagerSrcsetSizes(image, cable.title, '', 'thumb') }}
                      {% else %}
                          &lt;img src="/assets/img/fallback-cable-thumb.jpg" alt="No Image Available"&gt;
                      {% endif %}
                      &lt;h3 class="cable__tag"&gt;{{ cable.title }}&lt;/h3&gt;
                  &lt;/a&gt;
              &lt;/li&gt;
  
              {% endfor %}
          &lt;/ul&gt;
  
          {% for cable in cables.relatedTo(category) %}
              {% include '_includes/cables/cableModal' %}
          {% endfor %}
      &lt;/div&gt;
      {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-21T19:00:35.893Z
Comments.Text: You need to figure out if the time is being eaten by database queries (number and type) or code/PHP or a combination of both.  With devMode enabled, the SQL profiling output in the browser's console is sorted by slowest performing queries at the top.  Code profile output in `craft/storage/runtime/logs` is timestamped, so you can see where the big gaps are as the code is executing.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-21T22:27:54.113Z
Comments.Text: What do you mean by `When I look in my folders (in dropbox) I can see the folders get updated by not each image file.`? If you have the Imager config setting `cacheEnabled` = `false`, the images would be generated on every page load. My favourite way of debugging stuff like this is to just delete chunks of the templating code until I figure out what chunk takes the most time. ;)
Comments.UserDisplayName: André Elvan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-22T09:32:31.157Z
Comments.Text: @AndréElvan cacheEnabled is on by default I believe. When I say updating. I see the green icon turn to the blue updating icon in Dropbox (but this only happens for the folders and not the image files).
Comments.UserDisplayName: Terry Upton
Tags: <performance><eager-loading><mamp>
Title: Superslow loading of pages in Craft locally
ThreadText: # Superslow loading of pages in Craft locally
  
  (Asked by: username_0 on 2017-03-21)
  
  I am having trouble pinpointing the issue but I am struggling with some of my pages taking an absolute age to load. For example;
  
  ![Slow loading example](https://i.sstatic.net/hcnGJ.png)
  ![Slow loading example](https://i.sstatic.net/SNvC3.png)
  It might be a local MAMP issue, but some pages load fine and I would say these pages seem to load very slowly each time.
  
  it could be related to the imager plugin (generating lots of images (srcset and sizes) but I expect this only to run in the first instance not each time. When I look in my folders (in dropbox) I can see the folders get updated by not each image file.
  
  Or it could be my code and queries and setup, in particular Eager-loading.
  I am struggling to get my head around this and I have so far been unable to reduce the amount of queries, this also varies on each load from between 107ish to 115ish.
  
  Here is my code for this particular section. I do have related categories and images for each entry which I believe would benefit from Eager Loading, but I cannot establish if my code is correct for the eager loading?
  
  ```
  <div class="container">
      {% set categories = craft.categories.group('cables') %}
      {% set cables = craft.entries({
              section: 'cables',
              with: [
                  'cableCategory',
                  'cableImage',
              ],
              order:  'title'
      }) %}
  
      {% for category in categories.relatedTo(cables) %}
      <div class="cableGroup">
          <h2 class="panel__title">{{ category }}</h2>
          <div class="cableGroup__description content // margin-bottomX2">
              {{ category.description }}
          </div>
  
          <ul>
              {% for cable in cables.relatedTo(category) %}
              {% set image = cable.cableImage[0] ?? null %}
              <li class="cable">
                  <a href="#{{ cable.title|camel|upper }}" data-title="{{ cable.title }} &#xa;">
                      {% if image|length %}
                      {{ img.imagerSrcsetSizes(image, cable.title, '', 'thumb') }}
                      {% else %}
                          <img src="/assets/img/fallback-cable-thumb.jpg" alt="No Image Available">
                      {% endif %}
                      <h3 class="cable__tag">{{ cable.title }}</h3>
                  </a>
              </li>
  
              {% endfor %}
          </ul>
  
          {% for cable in cables.relatedTo(category) %}
              {% include '_includes/cables/cableModal' %}
          {% endfor %}
      </div>
      {% endfor %}
  </div>
  
  ```
  
  **Tags:** performance, eager-loading, mamp
  
  > **Comments:**
  > **username_1**: You need to figure out if the time is being eaten by database queries (number and type) or code/PHP or a combination of both.  With devMode enabled, the SQL profiling output in the browser's console is sorted by slowest performing queries at the top.  Code profile output in `craft/storage/runtime/logs` is timestamped, so you can see where the big gaps are as the code is executing.  
  > **username_2**: What do you mean by `When I look in my folders (in dropbox) I can see the folders get updated by not each image file.`? If you have the Imager config setting `cacheEnabled` = `false`, the images would be generated on every page load. My favourite way of debugging stuff like this is to just delete chunks of the templating code until I figure out what chunk takes the most time. ;)  
  > **username_0**: @username_2 cacheEnabled is on by default I believe. When I say updating. I see the green icon turn to the blue updating icon in Dropbox (but this only happens for the folders and not the image files).  
  
  ---
  
  ## 0 answers
  
  