-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid array allocation for moving to equal domain
chpl__coerceMove(_array) already has the ability to omit an array copy when the source and destination arrays refer to the same domain. However, when the domains have equal value but are separate instances, chpl__coerceMove would allocate a separate array and then move elements into it from the original array. This leads to unnecessary memory usage in some cases; for example, a recursive function that returns an array and so declares the return type. This commit adds a mechanism for array implementations to provide a way to steal the data buffers from another array which can be used in this scenario. In some ways this is similar to 'doiOptimizedSwap'. Note that 'doiOptimizedSwap' cannot be used here because we want to avoid allocation for one of the arrays. --- Signed-off-by: Michael Ferguson <[email protected]>
- Loading branch information
Showing
3 changed files
with
70 additions
and
8 deletions.
There are no files selected for viewing
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
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
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