Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make .rotate return a Seq, rather than a List, saves memory
- Add R:It.ReifiedRotate to produce rotated values from a reified list - Adapt List/Shaped1Array.rotate to use new iterator - Add Array.rotate to use new iterator, making sure it uses right descriptor - Add R:It.RotateIterator to produce rotated values from an iterator - Add Seq.rotate to use this iterator - Remove R:In.RotateListToList, it is no longer needed This change is mostly about memory usage, so will be most visible when applying .rotate on large lists / arrays. Instead of basically creating a clone of the list / array with the values in the right order, it produces the values on the fly, preventing a potentially costly copy. This also makes sure that .rotate produces containers with the right descriptor for list/arrays with holes in them. The Seq.rotate case does not need reification at all if the rotation value is greater than 0. This requires some tweaking in roast, as there are some tests assuming that .rotate always returns a list / array, rather than a Seq. This is currently also documented that way, which should also change. This change makes .rotate also to be in line with .reverse, which seems sensible to me. Finally, done this in one giant commit, so that it can be easily reverted should that be necessary.
- Loading branch information
Showing
6 changed files
with
169 additions
and
45 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
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