• Karandeep Bhatia's avatar
    UrlPatternIndex: Lazily compute rule count for UrlPatternIndexMatcher. · 1e4f99fa
    Karandeep Bhatia authored
    IndexedRuleset.median_match_time_avg/MatchAll perftest shows a
    regression after r759462 due to computation of rule count in the
    UrlPatternIndexMatcher constructor. This CL changes
    UrlPatternIndexMatcher rule count to be lazily computed which should
    ensure that the cost of computation is only paid by clients which use
    the rule count.
    
    When the perf test is run locally on my machine:
    
    Without this CL: *RESULT IndexedRuleset.median_match_time: MatchAll=
    231364 us
    With this CL: *RESULT IndexedRuleset.median_match_time:
    MatchAll= 80248 us
    
    Note that the test regression is exaggerated since the test creates a
    UrlPatternIndexMatcher for each request.
    
    BUG=1071599
    
    Change-Id: I6364e4b9043494d18389a41c517b90756ba4c8f9
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2153693
    Commit-Queue: Karan Bhatia <karandeepb@chromium.org>
    Auto-Submit: Karan Bhatia <karandeepb@chromium.org>
    Reviewed-by: default avatarCharlie Harrison <csharrison@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#759905}
    1e4f99fa
url_pattern_index_unittest.cc 35.7 KB