[foreign-memaccess+abi] RFR: 8264933: Improve stream support in memory segments
John Rose
john.r.rose at oracle.com
Fri Apr 9 23:52:29 UTC 2021
On Apr 9, 2021, at 6:48 AM, Maurizio Cimadamore <mcimadamore at openjdk.java.net<mailto:mcimadamore at openjdk.java.net>> wrote:
* for usability, let's add `MemorySegment::slices(MemoryLayout)`, which returns a _sequential_ stream of all the slices in a segment (with given element layout).
* for advanced use cases, including parallel streams, users will have to use spliterator + StreamSupport, as before.
This doesn't close the door to other stream-ified views to be added in the future. What do people think?
I like the previous spliterator proposal better for parallel
streams, because I think it interacts better with parallel
decomposition.
Isn’t it true that spliterators will tend to cut the bulk data
in half (or other large chunk) recursively until the cores
are busy, and then iterate? In that case, you only get enough
sub-segments to (safely!) manage the parallel decomposition.
If you stream over small slices, then you are slicing all the
time. Where would the per-core vectorized loops get to
work?
— John
More information about the panama-dev
mailing list