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

Merged
merged 3 commits into from
Dec 27, 2024
Merged

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

Verified

This commit was signed with the committer’s verified signature.
wojtekmaj Wojciech Maj
…help avoid unneccessary allocations of a new filter predicate delegate, every time the consumer desires to change filtering logic.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
@JakenVeina JakenVeina merged commit 37ffe9d into main Dec 27, 2024
1 check passed
@JakenVeina JakenVeina deleted the feature/filter-with-state-stream branch December 27, 2024 05:56
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: New higher-performance Filter() operators
2 participants