I've committed a feature which makes it possible to collapse long pages and load individual sections from the TOC. I've also improved section editing/viewing behavior to load subsections within a section instead of just the mother section. Long pages are collapsed when the user explicitly requests it ("Collapse page"), or when they are above a size threshold which can be set in the prefs (default 30K). I coded this primarily to address super-long pages like VfD.
The main problem I haven't been able to fix yet is that after saving a section, when coming from a section view, we return to the full article view (or collapsed if it is above the size threshold). I've experimented with passing parameters to avoid that but haven't quite found the right solution yet. If someone else wants to fix this, be my guest.
Another issue is that saving a section in a very long page still takes a fair amount of time. I haven't checked but I suspect this is because the entire links cache is updated. Surely some optimization would be possible here.
In terms of code, this isn't very clean yet as we have two quite redundant TOC generators now, one which generates from source and the other which generates from HTML. We probably should get rid of the one which generates from HTML and use the source generator for both types of TOC. This isn't entirely trivial as the TOC generation in OutputPage is entangled with other things like headline numbering and section edit links.
Obviously this feature would also benefit much from a more efficient way to store old revisions as right now a single edit in a single section on a 90K page will lead to another 90K revision in the OLD table.
On the plus side, rendering of collapsed pages is very fast as indeed only the intro has to be rendered (the headlines are also converted to HTML to make stripping of wikitags easier, but this is concatenated into a single step and thus quite unnoticeable).
Regards,
Erik