summaryrefslogtreecommitdiff
path: root/doc/todo/Improving_the_efficiency_of_match__95__glob.mdwn
blob: ff9784dd163c255867ba9958827447472fb20350 (plain)

I've been profiling my IkiWiki to try to improve speed (with many pages makes speed even more important) and I've written a patch to improve the speed of match_glob. This matcher is a good one to improve the speed of, because it gets called so many times.

Here's my patch - please consider it! -- [[KathrynAndersen]]

It seems to me as though changing glob2re to return qr/$re/, and calling memoize(glob2re) next to the other memoize calls, would be a less verbose way to do this? --[[smcv]]

I think so, yeah. Anyway, do you have any benchmark results handy, Kathryn? --[[Joey]]

See below. Also, would it make more sense for glob2re to return qr/^$re$/i rather than qr/$re/? Everything that uses glob2re seems to use $foo =~ /^$re$/i rather than /$re/ so I think that would make sense. -- [[KathrynAndersen]]


Benchmarks done with Devel::Profile on the same testbed IkiWiki setup. I'm just showing the start of the profile output, since that's what's relevant.

Before:

After:

Note that the seconds per call for match_glob in the "after" case has gone down by about a third.

K.A.