Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved suffix benchmark performance #7312

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

Cali0707
Copy link
Member

Fixes #7306

Proposed Changes

  • Don't copy strings if not needed when evaluating the suffix filter.

After these changes, the performance difference is:

benchmark                                                                                 old ns/op     new ns/op     delta
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_id-8                            53.3          54.4          +2.08%
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_id-8                                 556           445           -19.95%
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_all_context_attributes-8        90.1          91.6          +1.73%
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_all_context_attributes-8             1755          1298          -26.04%
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_all_context_attributes#01-8     91.8          91.5          -0.33%
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_all_context_attributes#01-8          1865          1315          -29.49%
BenchmarkSuffixFilter/Creation:_No_pass_with_suffix_match_of_id_and_source-8              62.2          63.4          +1.87%
BenchmarkSuffixFilter/Run:_No_pass_with_suffix_match_of_id_and_source-8                   672           478           -28.83%

benchmark                                                                                 old allocs     new allocs     delta
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_id-8                            1              1              +0.00%
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_id-8                                 5              4              -20.00%
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_all_context_attributes-8        1              1              +0.00%
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_all_context_attributes-8             21             15             -28.57%
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_all_context_attributes#01-8     1              1              +0.00%
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_all_context_attributes#01-8          21             15             -28.57%
BenchmarkSuffixFilter/Creation:_No_pass_with_suffix_match_of_id_and_source-8              1              1              +0.00%
BenchmarkSuffixFilter/Run:_No_pass_with_suffix_match_of_id_and_source-8                   5              4              -20.00%

benchmark                                                                                 old bytes     new bytes     delta
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_id-8                            8             8             +0.00%
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_id-8                                 224           208           -7.14%
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_all_context_attributes-8        8             8             +0.00%
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_all_context_attributes-8             571           448           -21.54%
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_all_context_attributes#01-8     8             8             +0.00%
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_all_context_attributes#01-8          571           448           -21.54%
BenchmarkSuffixFilter/Creation:_No_pass_with_suffix_match_of_id_and_source-8              8             8             +0.00%
BenchmarkSuffixFilter/Run:_No_pass_with_suffix_match_of_id_and_source-8                   236           217           -8.05%

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

The suffix filter is now faster!

Signed-off-by: Calum Murray <cmurray@redhat.com>
@knative-prow knative-prow bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 27, 2023
@Cali0707
Copy link
Member Author

/cc @Leo6Leo @creydr @pierDipi @matzew

@knative-prow knative-prow bot requested review from creydr, Leo6Leo and matzew September 27, 2023 20:00
@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (ff9444d) 77.66% compared to head (5b2ef1f) 77.64%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7312      +/-   ##
==========================================
- Coverage   77.66%   77.64%   -0.03%     
==========================================
  Files         250      250              
  Lines       13436    13436              
==========================================
- Hits        10435    10432       -3     
- Misses       2478     2480       +2     
- Partials      523      524       +1     
Files Coverage Δ
pkg/apis/duck/v1/subscribable_types.go 100.00% <ø> (ø)
pkg/apis/eventing/v1/trigger_types.go 100.00% <ø> (ø)
pkg/apis/flows/v1/parallel_types.go 100.00% <ø> (ø)
pkg/apis/flows/v1/sequence_types.go 100.00% <ø> (ø)
pkg/apis/messaging/v1/subscription_types.go 66.66% <ø> (ø)
pkg/eventfilter/subscriptionsapi/suffix_filter.go 66.66% <40.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@matzew matzew left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 28, 2023
@knative-prow
Copy link

knative-prow bot commented Sep 28, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Cali0707, matzew

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 28, 2023
@knative-prow knative-prow bot merged commit 88fe195 into knative:main Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Event Filtering: Improve Suffix filter performance
2 participants