1. 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.

Discussion in 'Resolved Bug Reports' started by Yoskaldyr, May 20, 2015.

  1. Yoskaldyr

    Yoskaldyr 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?
    semprot, SAS1024, GliX and 2 others like this.
  2. Yoskaldyr

    Yoskaldyr 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.
    imthebest likes this.
  3. Yoskaldyr

    Yoskaldyr 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.
  4. Mike

    Mike 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.
    rafass likes this.
  5. imthebest

    imthebest Formerly Super120

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

    Never noticed performance issues.
  6. Yoskaldyr

    Yoskaldyr Well-Known Member

    >500 route filters (one filter per each forum/category).
    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: May 21, 2015
  7. Rob

    Rob Well-Known Member

    500 filters per each forum / category? Is that a typo?
  8. Yoskaldyr

    Yoskaldyr Well-Known Member

    @Rob 500 route filters total (one route filter per each category/forum)
  9. CyclingTribe

    CyclingTribe Well-Known Member

    Just curious - but why are you using a route filter for every category and forum?
    cclaerhout likes this.
  10. Yoskaldyr

    Yoskaldyr Well-Known Member

    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.
    Liam W, SAS1024, imthebest and 4 others like this.
  11. Mike

    Mike XenForo Developer Staff Member

    I have changed this in 1.5 to store pre-calculated values.
    SAS1024, thedude, Alfa1 and 6 others like this.

Share This Page