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

Improve getindex performance on ChainedVector with UnitRanges #106

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented Oct 24, 2024

Before:

julia> using SentinelArrays, Chairmarks

julia> function f(inputs, range)
           ChainedVector(inputs)[range]
       end
f (generic function with 1 method)

julia> function g(inputs, range)
           reduce(vcat, inputs)[range]
       end
g (generic function with 1 method)

julia> vinputs = [rand(Float32, rand(1024:2048)) for _ = 1:90];

julia> @b f(vinputs, 1:95000)
64.666 μs (9 allocs: 372.125 KiB)

After:

julia> @b f(vinputs, 1:95000)
13.875 μs (9 allocs: 372.125 KiB)

@quinnj
Copy link
Member Author

quinnj commented Oct 24, 2024

Fixes #105

src/chainedvector.jl Outdated Show resolved Hide resolved
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