Body: <p>I ask this question a few weeks ago, but could not fix this problem. Now i have minimize my code.
  i use this loop: </p>
  
  <p><code>{% for program in craft.entries.section('program_point').order('program_number') %}</code></p>
  
  <p>and it takes 25s. The loop returns 81 data.</p>
  
  <p>Is there a way to speed this up?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-31T19:15:54.520Z
Comments.Text: If you enable [devMode](http://buildwithcraft.com/docs/config-settings#devMode) and load the page with that loop, then check in your browser's console, you'll see in the profiling section all of the database queries that are ordered by slowest performing at the top. Is there one that is taking 20+ seconds to execute?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-01T16:13:47.470Z
Comments.Text: @BradBell the number ad total shows the performing? The biggest is 0.05
Comments.UserDisplayName: Jonathan Schiffner
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-01T17:16:33.213Z
Comments.Text: Are there 500+ queries each taking up that amount of time?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-01T18:05:12.860Z
Comments.Text: @BradBell No there are 232 queries and most of them taking about 0.005
Comments.UserDisplayName: Jonathan Schiffner
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-01T19:55:32.823Z
Comments.Text: I don't think the line of code you shared is the problem, then. Look at the timestamps for the logs in `craft/storage/runtime/logs` for that request and see if you can spot the delay.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-02T10:34:51.173Z
Comments.Text: But if i delete this loop, the page loads in normal time. And in the logs i can't find anything about this problem.
Comments.UserDisplayName: Jonathan Schiffner
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-02T15:41:02.193Z
Comments.Text: What if you leave the loop in but remove all if it's contents (everything between `{% for %}` and `{% endfor %}`?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-02T19:56:01.063Z
Comments.Text: Now the loop takes about 6s. I think this is also to long.
  Here is the link of the site with the whole loop: [http://www.christlicher-gesundheitskongress.de/program.html] Maybe this gives you an idea...
  And here is the code: [https://jsfiddle.net/zkn1b8s2/]
Comments.UserDisplayName: Jonathan Schiffner
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-02T20:45:50.237Z
Comments.Text: Can you enable devMode on that site for a bit?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-02T21:19:39.313Z
Comments.Text: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/27701/discussion-between-jonathan-schiffner-and-brad-bell).
Comments.UserDisplayName: Jonathan Schiffner
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-02T21:24:37.120Z
Comments.Text: Did you try caching the the output, as I mentioned in my answer here? I assume this is also you, as a different username: http://craftcms.stackexchange.com/questions/11161/server-respond-is-very-long-25s-is-there-a-way-to-optimize-the-perfomance
Comments.UserDisplayName: RitterKnight
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-03T18:36:37.820Z
Comments.Text: thanks i did not now, that my colleague post this question too. Sorry!
Comments.UserDisplayName: Jonathan Schiffner
Tags: <templating><performance>
Title: 25s TTFB for one for-loop
ThreadText: # 25s TTFB for one for-loop
  
  (Asked by: username_0 on 2015-08-31)
  
  I ask this question a few weeks ago, but could not fix this problem. Now i have minimize my code.
  i use this loop:
  
  `{% for program in craft.entries.section('program_point').order('program_number') %}`
  
  and it takes 25s. The loop returns 81 data.
  
  Is there a way to speed this up?
  
  **Tags:** templating, performance
  
  > **Comments:**
  > **username_1**: If you enable [devMode](http://buildwithcraft.com/docs/config-settings#devMode) and load the page with that loop, then check in your browser's console, you'll see in the profiling section all of the database queries that are ordered by slowest performing at the top. Is there one that is taking 20+ seconds to execute?  
  > **username_0**: @username_1 the number ad total shows the performing? The biggest is 0.05  
  > **username_1**: Are there 500+ queries each taking up that amount of time?  
  > **username_0**: @username_1 No there are 232 queries and most of them taking about 0.005  
  > **username_1**: I don't think the line of code you shared is the problem, then. Look at the timestamps for the logs in `craft/storage/runtime/logs` for that request and see if you can spot the delay.  
  > **username_0**: But if i delete this loop, the page loads in normal time. And in the logs i can't find anything about this problem.  
  > **username_1**: What if you leave the loop in but remove all if it's contents (everything between `{% for %}` and `{% endfor %}`?  
  > **username_0**: Now the loop takes about 6s. I think this is also to long. Here is the link of the site with the whole loop: [http://www.christlicher-gesundheitskongress.de/program.html] Maybe this gives you an idea... And here is the code: [https://jsfiddle.net/zkn1b8s2/]  
  > **username_1**: Can you enable devMode on that site for a bit?  
  > **username_0**: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/27701/discussion-between-username_0-and-username_1).  
  > **username_2**: Did you try caching the the output, as I mentioned in my answer here? I assume this is also you, as a different username: http://craftcms.stackexchange.com/questions/11161/server-respond-is-very-long-25s-is-there-a-way-to-optimize-the-perfomance  
  > **username_0**: thanks i did not now, that my colleague post this question too. Sorry!  
  
  ---
  
  ## 0 answers
  
  