Ticket #1075 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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);

Change History

Changed 3 years ago by skrap

argh, sorry, I should have preformatted the diff.

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($page['tag']);
---
>                 $index_output .= $this->Link($page['tag'],'','',TRUE,TRUE,'','',TRUE);

Changed 3 years ago by BrianKoontz

  • component changed from unspecified to actions
  • milestone set to 1.4

Changed 3 years ago by BrianKoontz

(In [1804]) Link function now assumes that page to be linked exists by default. Refs #1075.

Changed 3 years ago by BrianKoontz

  • status changed from new to closed
  • resolution set to fixed

Changed 3 years ago by BrianKoontz

  • milestone changed from 1.4 to 1.3.2
Note: See TracTickets for help on using tickets.