Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Improve performance of metatag doesnt exist expr #1920

Merged
merged 3 commits into from
Oct 29, 2020

Conversation

replay
Copy link
Contributor

@replay replay commented Oct 9, 2020

Fixes #1871

This PR's branch is based on top of the branch of PR #1898, it only makes sense to review this PR once #1898 is merged.

This adds an optimization which is specific for queries that query for the absence of a meta tag of which all underlying expressions are using the = operator. This optimization currently already exists for queries which query for the presence of a meta tag using = and of which all underlying expressions are also using the = operator, in this PR that existing optimization gets extended to also work for filter expressions which check for the absence of a meta tag.

I also added a benchmark to test for that specific case, and It shows significant improvements with/without this change:

benchmark                                old ns/op        new ns/op     delta
BenchmarkFilterByAbsenceOfMetaTag-12     207231916200     253464875     -99.88%

benchmark                                old allocs     new allocs     delta
BenchmarkFilterByAbsenceOfMetaTag-12     407059         232777         -42.81%

benchmark                                old bytes     new bytes     delta
BenchmarkFilterByAbsenceOfMetaTag-12     37499976      34272224      -8.61%

@Dieterbe
Copy link
Contributor

ping @shanson7

@shanson7
Copy link
Collaborator

The changes look good to me and the improvement numbers look fantastic.

@replay replay force-pushed the improve_performance_of_metatag_doesnt_exist_expr branch from 06d0a86 to 23abfa4 Compare October 13, 2020 15:24
@Dieterbe
Copy link
Contributor

this PR needs an approval before it can be merged.
looks like @shanson7 has basically reviewed it already, and i suspect may be running this in prod already, so sean if you could approve this PR.. thanks :)

@shanson7
Copy link
Collaborator

We have not rolled these changes out yet. We have ben blocked on another item for a little while. I plan on doing a rollout with this and a few other recent improvements soon.

Copy link
Collaborator

@shanson7 shanson7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Dieterbe Dieterbe merged commit 9beff46 into master Oct 29, 2020
@Dieterbe Dieterbe deleted the improve_performance_of_metatag_doesnt_exist_expr branch October 29, 2020 13:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tag queries with "metatag does not exist" style expression extremely slow
3 participants