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

Bypass bracketing for AbstractRanges #192

Merged
merged 1 commit into from
Oct 14, 2023
Merged

Bypass bracketing for AbstractRanges #192

merged 1 commit into from
Oct 14, 2023

Conversation

DaniGlez
Copy link
Contributor

Bypass the bracketstrictlymontonic stage of the index lookup for ranges in searchsorted...correlated, because the corresponding searchsorted... functions for ranges in Base already do O(1) exact lookup without searching. This results in faster interpolation when t is a range. The first linear interpolation tests are also repeated for ranges.

Benchmark:

exec_times = Float64[]
for x in 3:9 
    N = 10^x
    u = rand(N)
    t = 1:N
    li = LinearInterpolation(u, t)
    b = @benchmark $li(rand($t))
    push!(exec_times, mean(b.times))
end

Results (the jump in latency in the PR at some points is probably because of cache misses as we're interpolating random elements):

image

Close #187

@ChrisRackauckas ChrisRackauckas merged commit 22b588d into SciML:master Oct 14, 2023
6 of 7 checks passed
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.

Specialize the bracketing index lookup for ranges
2 participants