• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Bad performance with many route filters.


Well-known member
In the XenForo_Link::buildPublicLink translateRouteFilterToRegex method is called for each route filter.
            list($from, $to) = self::translateRouteFilterToRegex(
               $filter['find_route'], $filter['replace_route']
And these calls heavy impact on performance especially on forum index page if the board has many forums/categories with route filters for it.

Why not prepare regex before saving them into 'routeFiltersOut' and 'routeFiltersIn' cache keys?


Well-known member
And the same problem with route matching if a many route filters exist.
And performance can be improved by caching regex results and grouping route filters in the 'routeFiltersIn' by prefix.


Well-known member
I can change a cache generation and match rules by my add-on and dirty hacks. But it is not too good and better if it will be in a XenForo core.


XenForo developer
Staff member
How many is "many route filters"? There isn't really an expectation of thousands (or likely even hundreds) as a targeted use case.


Well-known member
Well I have 63 route filters in place because I like to translate everything to my language.

Never noticed performance issues.


Well-known member
>500 route filters (one filter per each forum/category).
There isn't really an expectation of thousands (or likely even hundreds) as a targeted use case.
I know it.
But many on-the-fly regexes take lot of cpu time and these regexes can be done before caching. Also on match phase performance will be much greater if the route filters has been grouped by prefix or by first letter or by any other way.

This minimal changes do not break anything and will increase performance greatly on boards with many route filters.
Last edited:


Well-known member
Just curious - but why are you using a route filter for every category and forum?
One of my clients wants a separate clean seo-friendly url for each forum/category with different prefixes and different nested levels.

I understand that the route filters feature was designed only for small amount of filters, but with a minimal changing of a code it can handle a much more filters without performance penalties.