-
Notifications
You must be signed in to change notification settings - Fork 484
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
In-place all the things! (Arithmetic Edition) #119
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…wrapper around it
…ition/subtraction into shallow wrappers around it
… `remainderInPlace`
…nted in terms of `modInPlace`
… `sum`, `sq` & `sub` with minimal temporary array allocations
regexident
force-pushed
the
in-place-all-the-things
branch
from
September 24, 2019 14:51
872efd0
to
ddef618
Compare
…n favor of `numericCast(lm.count)`
regexident
changed the title
In place all the things
In-place all the things! (Arithmetic Edition)
Sep 24, 2019
This was referenced Sep 24, 2019
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds
…InPlace
function variants (internal
scoped) for every function in 'Arithmetic.swift', making use of the fact that Accelerate's functions commonly allow for aliasing of input and output buffers.This PR is a non-breaking implementation detail change, with the main benefit of being able to have all variants of a certain arithmetic operation be based on a single efficient
…InPlace
implementation.Currently these
…InPlace
variants are only exportedpublic
-ly by those functions with equivalent…=
operators.Given their clear performance & memory edge over their value-producing counter-parts due to a reduction of memory allocations & value copies however we might want to look into a way to export them
public
-ly without polluting the namespace.Further more we might want to mark some of the thin wrapper functions as
@inline
as some call might trampoline several layers before reaching the actual…InPlace
implementation?Notable mention: this PR also eliminates several unnecessary temporary value allocations! 🎉