Skip to content

add commit/diff query optimization

Administrator requested to merge cc/reduce into main

Created by: camdencheek

This adds the Reduce() method, which applies a set of reducers to our query.

Added reducers:

  • propagateBoolean: pushes boolean nodes upwards And(x, false) => false)
  • rewriteConjunctive: pushes and nodes upwards to take advantage of short-circuiting Or(x, And(y, z)) => And(Or(x,y), Or(x, z))
  • flatten: merges operators into like-kinded parents Or(Or(x,y), z) => Or(x, y, z)
  • mergeOrRegexp: merges regexp nodes in an or operator Or(AuthorMatches(a), AuthorMatches(b)) => Or(AuthorMatches(a|b))
  • sortAndByCost: sorts And operands by estimated cost to take advantage of short-circuiting And(DiffMatches(a), AuthorMatches(b)) => And(AuthorMatches(b), DiffMatches(a))

This is all the optimizations I had in mind, so I don't currently plan to expand these at all.

Also worth noting that I updated fuzz testing to compare against the reduced query.

Fixes #25174 (closed)

Merge request reports

Loading