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

Add tests and tweak None filter interest level #1

Merged

Conversation

ryanthomasjohnson
Copy link

  • Added tests for max level filtering and interest caching with multiple subscribers.
  • Changed the interest level for a None filter from sometimes to always so other filters can be cached more effectively.

* Added tests for max level filtering and interest caching with
multiple subscribers.
* Changed the interest level for a `None` filter from `sometimes`
to `always` so other filters can be cached more effectively.
// non-dynamic filter fn, which means the result can be cached per callsite.
// The filter fn should only need to be called once, and the `Option` filter
// should not interfere in the caching of that result.
assert_eq!(times_filtered.load(Ordering::Relaxed), 1);
Copy link
Author

Choose a reason for hiding this comment

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

With sometimes, the filter fn is evaluated three times:

  1. For the initial check to see if the callsite is enabled (effectively returns Interest::always)
  2. For the first debug event
  3. For the second debug event

With always, only #1 occurs. Both filters are always interested, so there's no need to reevaluate the filter fn.

@jsgf jsgf merged commit 8568d96 into jsgf:option-layer-filter May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants