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
Float.Array.blit: fix case when both arrays coincide #10070
Conversation
The caml_array_blit C primitives relies on memmove. Perhaps it would be more efficient? (The current implementation cannot be used with no-flat-float-array mode, one would need to restore the tag check, or create another primitive.) |
I also wondered about this. The following microbenchmark
gives
with
with the OCaml implementation (ie a ~1.2x speedup for In the case of overlapping arrays:
I got:
with
with the OCaml implementation (ie ~1.5x speedup for Given this, I pushed one more commit changing the implementation to use |
This bug is present since 4.08. It would be nice to have the bugfix in 4.12 cc @Octachron |
Only a 1.2 - 1.5 speedup by switching to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Please bow to check-typo and add a Changes entry.
I'm in favor of having this PR in 4.12, since it fixes a bug.
1b3e024
to
01ba808
Compare
01ba808
to
f9870b5
Compare
Thanks for the review.
Done.
I will merge to |
I also think that this is a fine bug fix for 4.12 . |
* Add test * Float.Array.blit: handle the case of overlapping arrays * Changes
Cherry-picked to 4.12 e307d1e |
* Add test * Float.Array.blit: handle the case of overlapping arrays * Changes
In spite of what the docstring says,
Float.Array.blit
does not correctly handle the case whensrc
anddst
are the same array.