Page MenuHomePhabricator

Let AbuseFilter cache its parser AST result
Open, MediumPublic

Description

I will investigate whether it's feasible to cache all ASTs at the same time.

Follows-up from:

Event Timeline

I haven't investigated this and don't plan on doing that soon, hence unlicking. A few things that come to mind:

  • An AST can be pretty big, so there could be a lot of data being cached if there are e.g. 200 active filters.
  • Currently, only CachingParser knows about the cache, so we'd need an intermediary between the parser and its current callers that would take care of caching. This might also be a good time to rename CachingParser to Evaluator (or something) and have it not deal with the actual parser (AFPTreeParser) inside.
  • The cache should be invalidated if any filter is created or modified.
  • Currently, only CachingParser knows about the cache, so we'd need an intermediary between the parser and its current callers that would take care of caching. This might also be a good time to rename CachingParser to Evaluator (or something) and have it not deal with the actual parser (AFPTreeParser) inside.

r716040 (WIP) goes in that direction, introducing such an intermediary class that controls the ASTs cache, and making the Evaluator not know about the previous steps (lexing, parsing, static checking). The new RuleChecker could also depend on FilterLookup and have a method for checking all active filters.