Ticket #1075 (closed defect: fixed)
Massive speedup to PageIndex action
| Reported by: | skrap | Owned by: | unassigned |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.3.2 |
| Component: | actions | Version: | 1.3 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
A pageindex request takes 18 seconds on my machine. I did some profiling, and it's happening because we're running a existsPage() call on each page link as we generate it. My wiki is massive, so this results in thousands of individual queries to the pages table in the DB. In this case, this check is unnecessary, as we just got the page name out or the DB, so it presumably still exists.
I wrote a patch to address this, which adds an additional optional parameter to Wakka::Link() to avoid the existsPage check. This takes the pageindex generation time down to < 1s on my machine.
diff -r /tmp/Wikka-1.3.1/libs/Wakka.class.php ./libs/Wakka.class.php 2284a2285
* @param boolean $assumePageExists optional:
2288c2289 < function Link($tag, $handler=, $text=, $track=TRUE, $escapeText=TRUE, $title=, $class=) ---
function Link($tag, $handler=, $text=, $track=TRUE, $escapeText=TRUE, $title=, $class=, $assumePageExists=FALSE)
2345c2346 < if (!$this->existsPage($tag)) ---
if (!$assumePageExists && !$this->existsPage($tag))
diff -r /tmp/Wikka-1.3.1/actions/pageindex/pageindex.php ./actions/pageindex/pageindex.php 104c104 < $index_output .= $this->Link($pagetag?); ---
$index_output .= $this->Link($pagetag?,,,TRUE,TRUE,,,TRUE);