sbrl / Pepperminty-Wiki

A wiki in a box
https://peppermint.mooncarrot.space/
Mozilla Public License 2.0
183 stars 22 forks source link

Searching: Do some profiling #157

Closed sbrl closed 6 years ago

sbrl commented 6 years ago

The personal wiki I'm powering with Pepperminty Wiki has grown tot he point where searching is beginning to take ~1.1s. We should do some profiling to figure out if there's some optimising we can do to bring this down a bit.

sbrl commented 6 years ago

I've optimised the search context extractor a lot, but it doesn't seem to have helped much :-(

Further investigation is needed.

sbrl commented 6 years ago

After doing some profiling with XDebug, a few things have come to light.

Looks like optimising the page id system has helped a lot! Next we need to utilise the inverted index in the search context extractor instead of running a regex. It's not the regex that's the issue curiously enough - it's the transliteration of the entire page content that's slowing us down.

sbrl commented 6 years ago

Yas! that did teh trick. Now context generation takes a much more respectable 59ms on average - a ton better than the ~1100m s from before.

Also, turns out getting page ids is comparatively expensive - so spending some time both optimising it and minimising the number of calls to it has done wonders.