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

fix map!(f,dest::ChainedVector,src::AbstractVector) #116

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

Conversation

laborg
Copy link
Contributor

@laborg laborg commented Dec 23, 2024

Fixes #115

With this PR the src is iterated instead of the probably longer destination.

Performance is better on this PR:

a,b=ChainedVector([rand(Int,5) for _ in 1:20000]),[1:100000...] # many chunks
@btime map!(i->-i,a,b)
# main: 188us
# pr: 153us

a,b=ChainedVector([[1:100000...]]),[1:100000...] # one chunk
@btime map!(i->-i,a,b)
# main: 171us
# pr: 73.8us

the longer `dest` was iterated, leading to an error if `src` was shorter than `dest`.
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.

map!(f,dest::ChainedVector,src::AbstractArray) doesn't work for shorter src
1 participant