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

replace[!]() with count is broken #112

Open
laborg opened this issue Dec 21, 2024 · 1 comment · May be fixed by #113
Open

replace[!]() with count is broken #112

laborg opened this issue Dec 21, 2024 · 1 comment · May be fixed by #113

Comments

@laborg
Copy link
Contributor

laborg commented Dec 21, 2024

replace as well as replace! do not work properly if count is supplied:

julia> replace(ChainedVector([[1,2],[1,2]]), 2=>20; count=1)
6-element ChainedVector{Int64, Vector{Int64}}:
  1
 20
  1
 20

julia> replace([1,2,1,2],1=>20,count=1) # expectation
4-element Vector{Int64}:
 20
  2
  1
  2

The underlying code just applies the count limitation to each chunk.

Sprinkeling @inbounds on the array get/setindex didn't improve performance, but I should probably add it.

@laborg
Copy link
Contributor Author

laborg commented Jan 3, 2025

@quinnj ChainedVectors are used quite a lot downstream, so even such subtle bugs can annoy many users.

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 a pull request may close this issue.

1 participant