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

Added benchmark for any filter #7195

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

Cali0707
Copy link
Member

Fixes #7112

Proposed Changes

  • Benchmark the overhead of using the any filter with a single nested filter
  • Benchmark performance when there is an early match
  • Benchmark performance when there is no early match

The benchmark results are:

goos: linux
goarch: amd64
pkg: knative.dev/eventing/pkg/eventfilter/benchmarks
cpu: Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz
BenchmarkAnyFilter
BenchmarkAnyFilter/Creation:_Any_filter_with_exact_filter_test
BenchmarkAnyFilter/Creation:_Any_filter_with_exact_filter_test-8         	14015557	        72.60 ns/op
BenchmarkAnyFilter/Run:_Any_filter_with_exact_filter_test
BenchmarkAnyFilter/Run:_Any_filter_with_exact_filter_test-8              	 1592767	       647.1 ns/op
BenchmarkAnyFilter/Creation:_Any_filter_match_all_subfilters
BenchmarkAnyFilter/Creation:_Any_filter_match_all_subfilters-8           	10254110	       105.0 ns/op
BenchmarkAnyFilter/Run:_Any_filter_match_all_subfilters
BenchmarkAnyFilter/Run:_Any_filter_match_all_subfilters-8                	 1759063	       657.1 ns/op
BenchmarkAnyFilter/Creation:_Any_filter_no_1_match_at_end_of_array
BenchmarkAnyFilter/Creation:_Any_filter_no_1_match_at_end_of_array-8     	10086103	       105.2 ns/op
BenchmarkAnyFilter/Run:_Any_filter_no_1_match_at_end_of_array
BenchmarkAnyFilter/Run:_Any_filter_no_1_match_at_end_of_array-8          	  725652	      1801 ns/op
BenchmarkAnyFilter/Creation:_Any_filter_no_1_match_at_start_of_array
BenchmarkAnyFilter/Creation:_Any_filter_no_1_match_at_start_of_array-8   	10491618	        97.71 ns/op
BenchmarkAnyFilter/Run:_Any_filter_no_1_match_at_start_of_array
BenchmarkAnyFilter/Run:_Any_filter_no_1_match_at_start_of_array-8        	 1780578	       656.0 ns/op
BenchmarkAttributesFilter
BenchmarkAttributesFilter/Creation:_Pass_with_exact_match_of_id
BenchmarkAttributesFilter/Creation:_Pass_with_exact_match_of_id-8        	583618110	         1.920 ns/op
BenchmarkAttributesFilter/Run:_Pass_with_exact_match_of_id
BenchmarkAttributesFilter/Run:_Pass_with_exact_match_of_id-8             	12381978	        86.46 ns/op
BenchmarkAttributesFilter/Creation:_Pass_with_exact_match_of_all_context_attributes_(except_time)
BenchmarkAttributesFilter/Creation:_Pass_with_exact_match_of_all_context_attributes_(except_time)-8         	611194980	         1.913 ns/op
BenchmarkAttributesFilter/Run:_Pass_with_exact_match_of_all_context_attributes_(except_time)
BenchmarkAttributesFilter/Run:_Pass_with_exact_match_of_all_context_attributes_(except_time)-8              	 1412710	       832.3 ns/op
BenchmarkAttributesFilter/Creation:_No_pass_with_exact_match_of_id_and_source
BenchmarkAttributesFilter/Creation:_No_pass_with_exact_match_of_id_and_source-8                             	580129804	         1.898 ns/op
BenchmarkAttributesFilter/Run:_No_pass_with_exact_match_of_id_and_source
BenchmarkAttributesFilter/Run:_No_pass_with_exact_match_of_id_and_source-8                                  	 3586198	       317.9 ns/op
BenchmarkExactFilter
BenchmarkExactFilter/Creation:_Pass_with_exact_match_of_id
BenchmarkExactFilter/Creation:_Pass_with_exact_match_of_id-8                                                	12346545	        81.33 ns/op
BenchmarkExactFilter/Run:_Pass_with_exact_match_of_id
BenchmarkExactFilter/Run:_Pass_with_exact_match_of_id-8                                                     	 3054868	       377.2 ns/op
BenchmarkExactFilter/Creation:_Pass_with_exact_match_of_all_context_attributes_(except_time)
BenchmarkExactFilter/Creation:_Pass_with_exact_match_of_all_context_attributes_(except_time)-8              	 9777397	       115.4 ns/op
BenchmarkExactFilter/Run:_Pass_with_exact_match_of_all_context_attributes_(except_time)
BenchmarkExactFilter/Run:_Pass_with_exact_match_of_all_context_attributes_(except_time)-8                   	  995092	      1124 ns/op
BenchmarkExactFilter/Creation:_No_pass_with_exact_match_of_id_and_source
BenchmarkExactFilter/Creation:_No_pass_with_exact_match_of_id_and_source-8                                  	12550750	        89.79 ns/op
BenchmarkExactFilter/Run:_No_pass_with_exact_match_of_id_and_source
BenchmarkExactFilter/Run:_No_pass_with_exact_match_of_id_and_source-8                                       	 1771851	       608.3 ns/op
BenchmarkNotFilter
BenchmarkNotFilter/Creation:_Not_filter_with_exact_filter_test
BenchmarkNotFilter/Creation:_Not_filter_with_exact_filter_test-8                                            	29736352	        39.58 ns/op
BenchmarkNotFilter/Run:_Not_filter_with_exact_filter_test
BenchmarkNotFilter/Run:_Not_filter_with_exact_filter_test-8                                                 	 2982740	       396.5 ns/op
BenchmarkNotFilter/Creation:_Not_filter_with_prefix_filter_test
BenchmarkNotFilter/Creation:_Not_filter_with_prefix_filter_test-8                                           	29168329	        38.16 ns/op
BenchmarkNotFilter/Run:_Not_filter_with_prefix_filter_test
BenchmarkNotFilter/Run:_Not_filter_with_prefix_filter_test-8                                                	 2407800	       483.4 ns/op
BenchmarkNotFilter/Creation:_Not_filter_with_suffix_filter_test
BenchmarkNotFilter/Creation:_Not_filter_with_suffix_filter_test-8                                           	35003146	        37.39 ns/op
BenchmarkNotFilter/Run:_Not_filter_with_suffix_filter_test
BenchmarkNotFilter/Run:_Not_filter_with_suffix_filter_test-8                                                	 1768186	       644.0 ns/op
BenchmarkPrefixFilter
BenchmarkPrefixFilter/Creation:_Pass_with_prefix_match_of_id
BenchmarkPrefixFilter/Creation:_Pass_with_prefix_match_of_id-8                                              	18324410	        60.21 ns/op
BenchmarkPrefixFilter/Run:_Pass_with_prefix_match_of_id
BenchmarkPrefixFilter/Run:_Pass_with_prefix_match_of_id-8                                                   	 2694043	       480.6 ns/op
BenchmarkPrefixFilter/Creation:_Pass_with_prefix_match_of_all_context_attributes
BenchmarkPrefixFilter/Creation:_Pass_with_prefix_match_of_all_context_attributes-8                          	11593155	        94.42 ns/op
BenchmarkPrefixFilter/Run:_Pass_with_prefix_match_of_all_context_attributes
BenchmarkPrefixFilter/Run:_Pass_with_prefix_match_of_all_context_attributes-8                               	  777190	      1713 ns/op
BenchmarkPrefixFilter/Creation:_Pass_with_prefix_match_of_all_context_attributes#01
BenchmarkPrefixFilter/Creation:_Pass_with_prefix_match_of_all_context_attributes#01-8                       	11401508	        96.07 ns/op
BenchmarkPrefixFilter/Run:_Pass_with_prefix_match_of_all_context_attributes#01
BenchmarkPrefixFilter/Run:_Pass_with_prefix_match_of_all_context_attributes#01-8                            	  753309	      1722 ns/op
BenchmarkPrefixFilter/Creation:_No_pass_with_prefix_match_of_id_and_source
BenchmarkPrefixFilter/Creation:_No_pass_with_prefix_match_of_id_and_source-8                                	15823159	        72.25 ns/op
BenchmarkPrefixFilter/Run:_No_pass_with_prefix_match_of_id_and_source
BenchmarkPrefixFilter/Run:_No_pass_with_prefix_match_of_id_and_source-8                                     	 2340697	       517.8 ns/op
BenchmarkSuffixFilter
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_id
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_id-8                                              	17811429	        60.96 ns/op
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_id
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_id-8                                                   	 2468887	       486.4 ns/op
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_all_context_attributes
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_all_context_attributes-8                          	11337162	        95.67 ns/op
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_all_context_attributes
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_all_context_attributes-8                               	  674100	      1733 ns/op
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_all_context_attributes#01
BenchmarkSuffixFilter/Creation:_Pass_with_suffix_match_of_all_context_attributes#01-8                       	11199142	       101.6 ns/op
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_all_context_attributes#01
BenchmarkSuffixFilter/Run:_Pass_with_suffix_match_of_all_context_attributes#01-8                            	  677655	      1789 ns/op
BenchmarkSuffixFilter/Creation:_No_pass_with_suffix_match_of_id_and_source
BenchmarkSuffixFilter/Creation:_No_pass_with_suffix_match_of_id_and_source-8                                	15079150	        70.69 ns/op
BenchmarkSuffixFilter/Run:_No_pass_with_suffix_match_of_id_and_source
BenchmarkSuffixFilter/Run:_No_pass_with_suffix_match_of_id_and_source-8                                     	 2270575	       527.0 ns/op
PASS

Signed-off-by: Calum Murray <cmurray@redhat.com>
@knative-prow knative-prow bot requested review from aslom and matzew August 22, 2023 20:20
@knative-prow knative-prow bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 22, 2023
@Cali0707
Copy link
Member Author

/cc @pierDipi @Leo6Leo

@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.03% ⚠️

Comparison is base (a2e2aa3) 77.95% compared to head (07572ca) 77.92%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7195      +/-   ##
==========================================
- Coverage   77.95%   77.92%   -0.03%     
==========================================
  Files         246      246              
  Lines       13202    13202              
==========================================
- Hits        10291    10288       -3     
- Misses       2390     2392       +2     
- Partials      521      522       +1     

see 1 file with indirect coverage changes

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

@matzew
Copy link
Member

matzew commented Aug 24, 2023

/test reconciler-tests

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 Aug 24, 2023
@knative-prow
Copy link

knative-prow bot commented Aug 24, 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 Aug 24, 2023
@matzew
Copy link
Member

matzew commented Aug 24, 2023

/test upgrade-tests

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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Event Filtering: Benchmark the "Any" SubscriptionsAPI filter
2 participants