Repository navigation
Avoid temporary arrays for independent numeric generators - #2944
Draft
rithikasridharbabu-2007 wants to merge 1 commit into
Draft
rithikasridharbabu-2007 wants to merge 1 commit into
rithikasridharbabu-2007 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or 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
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.
Checklist
Description
Assigning
arangeorlinspaceto an existing contiguous container currently creates a full-size temporary because generators conservatively retain overlap protection. This adds an opt-inis_memory_independenttrait, forwards it throughxgenerator, and opts in arithmeticarange_generatorspecializations, used by both builders. Same-size assignments can then reuse existing storage.Container assignment validates the shape before entering a generator’s
noexcept assign_to. Unknown generators, including generators that read the destination, retain overlap protection. Forced-temporary mode is respected. Views and dynamically strided containers retain their current assignment paths: direct view assignment was slower than generating into a contiguous temporary in the local diagnostic.Related to #2943. This is a focused first step for plain arithmetic
arange/linspaceassignments, rather than a complete solution for all generators or composed expressions.Validation
test_xbuilder,test_xassign,test_xarray,test_xtensor,test_xview,test_xrandom,test_xnoalias,test_xadapt, andtest_xfixed. Automatic overlap detection was enabled withXTENSOR_FORCE_TEMPORARY_MEMORY_IN_ASSIGNMENTS=OFF.arange/linspaceassignment, resizing and empty output, an unknown generator reading the destination in reverse, self-concatenation, and dimension mismatch. The assignment suite passes 5 cases / 49 assertions.-O3 -DNDEBUGshowed the additional element-buffer allocation falling from 8 MiB to zero for 1,048,576 doubles. All generated values were checked. Allocation instrumentation and default-allocator timings were measured separately. Large container timings were close; no general runtime speedup is claimed.Remaining validation / draft status
xtl::xmasked_value. Reproduced with xtl 0.8.0 and 0.8.2. Full-suite success is not claimed.Opening as a draft for feedback on the trait and the container-only scope while these validation limits remain.