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

New Filter Operators: #758 #941

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JakenVeina
Copy link
Collaborator

Added new Filter operators that utilize a predicate state stream, to help avoid unneccessary allocations of a new filter predicate delegate, every time the consumer desires to change filtering logic.

public static IObservable<IChangeSet<TObject, TKey>> Filter<TObject, TKey, TState>(
        this    IObservable<IChangeSet<TObject, TKey>>  source,
                IObservable<TState>                     predicateState,
                Func<TState, TObject, bool>             predicate,
                bool                                    suppressEmptyChangeSets = true)
    where TObject : notnull
    where TKey : notnull
Method Mean Error StdDev Ratio Allocated Alloc Ratio
RandomizedEditsAndStateChanges 345.4 ms 6.90 ms 17.80 ms 1.00 8.57 MB 1.00
public static IObservable<IChangeSet<T>> Filter<T, TState>(
        this    IObservable<IChangeSet<T>>  source,
                IObservable<TState>         predicateState,
                Func<TState, T, bool>       predicate,
                ListFilterPolicy            filterPolicy            = ListFilterPolicy.CalculateDiff,
                bool                        suppressEmptyChangeSets = true)
    where T : notnull
Method FilterPolicy Mean Error StdDev Ratio Allocated Alloc Ratio
RandomizedEditsAndStateChanges ClearAndReplace 26.37 ms 0.510 ms 0.663 ms 1.00 1.88 MB 1.00
RandomizedEditsAndStateChanges CalculateDiff 43.68 ms 0.868 ms 1.673 ms 1.00 3.63 MB 1.00

…help avoid unneccessary allocations of a new filter predicate delegate, every time the consumer desires to change filtering logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: New higher-performance Filter() operators
1 participant