I spoke to Gideon a little while back about this and done some more research myself so I'll post my findings.
The basic reason that the pages take so long to load is because ALL answers and comments for a question are loaded from the database, even if they will not be displayed. Not only that, but ALL these posts are processed in PHP as if they are all going to be displayed.
The database queries themselves are actually not very slow, the biggest time sink is processing every post. This is done in qa-page-question.php around line 70ish, specifically these two blocks of code:
foreach ($answers as $key => $answer) {
$answers[$key]=$answer+qa_page_q_post_rules($answer, $question, $answers, $achildposts);
$answers[$key]['isselected']=($answer['postid']==$question['selchildid']);
}
foreach ($commentsfollows as $key => $commentfollow) {
$parent=($commentfollow['parentid']==$questionid) ? $question : @$answers[$commentfollow['parentid']];
$commentsfollows[$key]=$commentfollow+qa_page_q_post_rules($commentfollow, $parent, $commentsfollows, null);
}
So the solution would seem to be substituting $answers and $commentsfollows for just the ones appearing on the current page. For a regular Q&A with answers sorted by votes, this is not really possible here because the $answers array is not ordered until much later.
For posts ordered by time this does appear to be possible as we can get the start parameter in the URL and grab a portion of the $answers array easily. Then skip any comments not attached to one of those answers.
So I just wanted to put this information out there. Maybe it will help anyone else understand/mitigate the problem if they hit it.