Skip to content

Microbenchmark for Trigger Filter#4517

Merged
knative-prow-robot merged 6 commits into
knative:masterfrom
slinkydeveloper:filter_microbenchmark
Nov 12, 2020
Merged

Microbenchmark for Trigger Filter#4517
knative-prow-robot merged 6 commits into
knative:masterfrom
slinkydeveloper:filter_microbenchmark

Conversation

@slinkydeveloper
Copy link
Copy Markdown
Contributor

@slinkydeveloper slinkydeveloper commented Nov 12, 2020

Signed-off-by: Francesco Guardiani francescoguard@gmail.com

This adds microbenchmarks to test implementations of eventfilter.Filter.

Note: although it doesn't make sense to test for the attributes filter the creation of the filter instance, it makes sense for more complex filters like in the context of #3359 and #4495, where creating the filter means transforming the user input in some middle representation (like an AST or a schema instance) which is not trivial to create

Proposed Changes

  • Add generic microbenchmark to test creation and run of the filter implementation
  • Add attributes microbenchmark tests

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Nov 12, 2020
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 12, 2020
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: slinkydeveloper

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

The pull request process is described here

Details 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-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 12, 2020
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@knative-prow-robot knative-prow-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 12, 2020
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 12, 2020

Codecov Report

Merging #4517 (253486d) into master (3b560a3) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4517   +/-   ##
=======================================
  Coverage   81.27%   81.27%           
=======================================
  Files         284      284           
  Lines        8017     8017           
=======================================
  Hits         6516     6516           
  Misses       1113     1113           
  Partials      388      388           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b560a3...4a0db25. Read the comment docs.

@zhongduo
Copy link
Copy Markdown
Contributor

/assign

Comment thread pkg/eventfilter/benchmarks/common_benchmark_test.go Outdated
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@zhongduo
Copy link
Copy Markdown
Contributor

/lgtm
/hold in case you want to add comment to the RunFilterBenchmarks, which is shared by future usage too I guess. Unhold it if you decide not to do it.

@knative-prow-robot knative-prow-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Nov 12, 2020
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 12, 2020
@slinkydeveloper
Copy link
Copy Markdown
Contributor Author

@zhongduo comment added, to explain what benchmarks we're running

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 12, 2020
@slinkydeveloper
Copy link
Copy Markdown
Contributor Author

@zhongduo Can you re-lgtm please? Adding one comment require lgtm again 😞

@zhongduo
Copy link
Copy Markdown
Contributor

/lgtm Thanks.

Copy link
Copy Markdown
Member

@pierDipi pierDipi left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 12, 2020
@knative-prow-robot knative-prow-robot merged commit 7e7bf40 into knative:master Nov 12, 2020
Comment on lines +35 to +36
var Filter eventfilter.Filter
var Result eventfilter.FilterResult
Copy link
Copy Markdown
Member

@pierDipi pierDipi Nov 12, 2020

Choose a reason for hiding this comment

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

I think we should rename those types, the usage it's unreadable, too many filter.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Which names do you propose?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IIUC, these are just to avoid DCE. So the variables are really not designed to be used. I would suggest to use lower case if I want to be picky. Also sth like filterForNoDCE.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To be 100% you exclude DCE, you need variables to be exported

Copy link
Copy Markdown
Member

@pierDipi pierDipi Nov 12, 2020

Choose a reason for hiding this comment

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

I meant package.type not variable names.

trigger.Filter
trigger.FilterResult

wdyt?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

or filter.Interface and filter.Result

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And where should this trigger module should live? Under eventing/pkg/trigger? Not sure, to me eventfilter, although it's repeated a couple of times, sounds like a good name (and note, this code is not specific at all to trigger, in fact at some point it was even discussed to implement filters at source level)

@slinkydeveloper slinkydeveloper deleted the filter_microbenchmark branch November 12, 2020 17:04
@zhongduo
Copy link
Copy Markdown
Contributor

zhongduo commented Nov 12, 2020 via email

@slinkydeveloper
Copy link
Copy Markdown
Contributor Author

hmm, is it possible to do a quick test?

WDYM? Are you talking about having the variable exported or not?

@slinkydeveloper
Copy link
Copy Markdown
Contributor Author

Even if your compiler cannot optimize today an unexported variable, it might still do it in future (due to the evolution of the escape analysis), that's why it generally makes sense to make it always exported

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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants