Microbenchmark for Trigger Filter#4517
Conversation
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report
@@ 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.
|
|
/assign |
|
/lgtm |
|
@zhongduo comment added, to explain what benchmarks we're running /unhold |
|
@zhongduo Can you re-lgtm please? Adding one comment require lgtm again 😞 |
|
/lgtm Thanks. |
| var Filter eventfilter.Filter | ||
| var Result eventfilter.FilterResult |
There was a problem hiding this comment.
I think we should rename those types, the usage it's unreadable, too many filter.
There was a problem hiding this comment.
Which names do you propose?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
To be 100% you exclude DCE, you need variables to be exported
There was a problem hiding this comment.
I meant package.type not variable names.
trigger.Filter
trigger.FilterResult
wdyt?
There was a problem hiding this comment.
or filter.Interface and filter.Result
There was a problem hiding this comment.
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)
|
hmm, is it possible to do a quick test? I have a compiler background,
though for C/C++. But as long as a variable can be used outside the
function, DCE will have trouble optimizing it. So in this case you can have
an in-package function that monitor these variables, which will be
effectively the same as exported variables since they can be used outside
the function.
…On Thu, Nov 12, 2020 at 12:16 PM Francesco Guardiani < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pkg/eventfilter/benchmarks/common_benchmark_test.go
<#4517 (comment)>:
> +var Filter eventfilter.Filter
+var Result eventfilter.FilterResult
To be 100% you exclude DCE, you need variables to be exported
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4517 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACE6CNFEBBYDGMFHMOK4VMDSPQJ7JANCNFSM4TTMLMMA>
.
|
WDYM? Are you talking about having the variable exported or not? |
|
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 |
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