I am an avid user of org mode for all of my notes (usually kept under headlines with dates) and TODOs. I now have 5 agenda files with a total of about 25,000 lines, about 25% of which are headlines. 

Sometimes, when I run agenda, it is very slow to compile - about 10-15 seconds. During these times, it is also slow to scroll through the high level headings (about 5-6 seconds each to get to the next heading). However, others times, the same commands are much faster - 2 seconds to compile the agenda and an immediate response when scrolling. I can't find a pattern to when it is slow versus fast. It is usually fast the first time I open emacs, even if I just restarted the computer and opened emacs. It doesn't seem to matter what else is running on the computer. Sometimes it stays fast for several hours, and then all of sudden will be slow - even if nothing has been added to the file in the meantime. 

I've considered some major changes to try and fix this, like converting all of my headlines that don't have todo items (i.e. notes that start with a date) to a list instead of a headline. I've also considered trying to use the logbook for notes instead of headlines. However, if it is just having trouble scanning through so many headlines, I don't understand why it can compile the agenda fast some times and not others. I also don't know if scroll would be any faster, because the same number of lines would still be there.  If scroll was always slow at first and then fast later, that might make sense too (maybe it is remembering some of the structure after the first scroll?).

Below is a list of my agenda command - maybe it is too long? When it is slow, it is slow no matter what TODO I am trying to compile.

Any thoughts? 
Thank you!

(setq org-agenda-custom-commands
      '(("d" "Daily Action List (work)"
((agenda "" ((org-agenda-ndays 5)
     (org-deadline-warning-days 0)
     (org-agenda-repeating-timestamp-show-all t)
     (org-agenda-skip-scheduled-if-done nil)))))
("n" "NextActions List (work)"
((agenda "" ((org-agenda-ndays 1)
     (org-use-tag-inheritance nil)
     (org-agenda-repeating-timestamp-show-all t)))
 (tags-todo "work+TODO=\"NEXTACTION\"" 
    ((org-agenda-skip-function
      '(org-agenda-skip-entry-if 'scheduled))))))
("p" "Active Projects List (work)"
((tags-todo "work/PRJ" 
    ((org-agenda-skip-function '(org-agenda-skip-entry-if
 'scheduled))
     ))))
("o" "Ongoing Projects List (work)"
((tags-todo "work/ONGOING" 
    ((org-agenda-skip-function '(org-agenda-skip-entry-if
 'scheduled))  ))))    
("w" "Waiting For List (work)"
((tags-todo "work/WAITING")))
("s" "Someday/Maybe List (work)"
((tags-todo "work/SOMEDAY" )))
("y" "Delegated Projects (work)"
((tags-todo "work/YOUDO")))
("H" "How To List"
((tags "HowTo")))
("g" "Things to google"
((tags "google")))
("a" "agendas (work)"
((tags-todo "work/AGENDA"
    ((org-agenda-skip-function '(org-agenda-skip-entry-if
 'scheduled))
     ))))
("N" "NextActions List (home)"
((agenda "" ((org-agenda-ndays 1)
     (org-agenda-repeating-timestamp-show-all t)))
 (tags-todo
  "home+TODO=\"NEXTACTION\"" 
  ((org-agenda-skip-function '(org-agenda-skip-entry-if
'scheduled))  ))))
("P" "Active Projects List (home)"
((tags-todo "home/PRJ" 
    ((org-agenda-skip-function '(org-agenda-skip-entry-if
 'scheduled))
     ))))
("O" "Ongoing Projects List (home)"
((tags-todo "home/ONGOING" 
    ((org-agenda-skip-function '(org-agenda-skip-entry-if
 'scheduled))  ))))    
("W" "Waiting For List (home)"
((tags-todo "home/WAITING")))
("S" "Someday/Maybe List (home)"
((tags-todo "home/SOMEDAY" )))
("Y" "Delegated Projects (home)"
((tags-todo "home/YOUDO")))
("A" "agendas (home)"
((tags-todo "home/AGENDA"
    ((org-agenda-skip-function '(org-agenda-skip-entry-if
 'scheduled))
     ))))
))