Skip to content

Search backend: use non-capturing groups for union regexp

Administrator requested to merge backend-integration/cc/optimize-union-regexp into main

Created by: camdencheek

Unioning regex patterns with capturing groups causes a severe performance hit compared to non-capturing groups, so this modifies UnionRegexp and the commit search optimizer to union with non-capturing groups instead.

This dramatically reduces the cost of unioned OR queries. For one diff query, it brought the total search time down from 9s to 1.2s.

Slack thread with more discovery/context

Test plan

Running backend-dry-run and tested the commit or queries manually to ensure they were behaving correctly (and performantly).

Merge request reports

Loading