Patrick Molgaard bbdc20f8ca
perf: partially lift matching from regexp to js (#9032)
Digging further into #3857.

See also #8955, #8956.

As [previously
discussed](https://github.com/typeorm/typeorm/issues/3857#issuecomment-699505893),
the query builder currently suffers from poor performance in two ways:
quadratic numbers of operations with respect to total table/column
counts, and poor constant factor performance (regexps can be expensive
to build/run!)

The constant-factor performance is the more tractable problem: no longer
quadratically looping would be a chunky rewrite of the query builder,
but we can locally refactor to be a bunch cheaper in terms of regexp
operations.

This change cuts the benchmark time here in ~half (yay!).

We achieve this by simplifying the overall replacement regexp (we don't
need our column names in there, since we already have a plain object
where they're the keys to match against) so compilation of that is much
cheaper, plus skipping the need to `escapeRegExp` every column as a
result.
2022-05-31 20:56:42 +05:00
..
2022-03-17 21:01:45 +05:00
2022-03-17 21:01:45 +05:00