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 improved searchsortedfirstcorrelated and bracketstrictlymontonic #3

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

ChrisRackauckas
Copy link
Member

For benchmarks see:

While the cost of constructing the interpolator does not change, tracking the last index results in a best-case speedup of ~2.7x for CubicSpline, when successive values are close together (and a little higher for simpler interpolators). In the worst case (where successive values are always on opposite ends of the vectors), it can result in a ~15% slowdown due to the unhelpful expanding binary search at the beginning. However, the original approach of not tracking the index at all is also still available; it now involves essentially one extra if statement, which seems to be lost in the timing noise.

For benchmarks see:

* SciML/DataInterpolations.jl#198
* SciML/DataInterpolations.jl#147

> While the cost of constructing the interpolator does not change, tracking the last index results in a best-case speedup of ~2.7x for CubicSpline, when successive values are close together (and a little higher for simpler interpolators). In the worst case (where successive values are always on opposite ends of the vectors), it can result in a ~15% slowdown due to the unhelpful expanding binary search at the beginning. However, the original approach of not tracking the index at all is also still available; it now involves essentially one extra if statement, which seems to be lost in the timing noise.
@ChrisRackauckas
Copy link
Member Author

Note this is using some downstream tests to supplement since DataInterpolations covers the sorted search pretty comprehensively.

@ChrisRackauckas ChrisRackauckas merged commit 1a45198 into main Jan 25, 2024
4 of 5 checks passed
@ChrisRackauckas ChrisRackauckas deleted the searchsorted branch January 25, 2024 20:40
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.

1 participant