Proposed Changes to the Range API for Phobos v3
Eyal Lotem
eyal at weka.io
Mon Sep 23 18:41:53 UTC 2024
On Monday, 23 September 2024 at 08:56:20 UTC, monkyyy wrote:
> On Monday, 23 September 2024 at 08:20:59 UTC, Eyal Lotem wrote:
>> showing how a single-method range protocol is better
>> optimized[1] than the 3 method range protocol.
>> **opApplyRange**
>
> Is opApply even an iterator interface? Per the talk comparing
> the function count of iterators
>
> https://youtu.be/d3qY4dZ2r4w?si=sRWCtba_njjqrOCP
>
It's more restrictive because it can't do zip or some other
things. I don't suggest using opApply as a replacement. It's
merely a proof that Phobos ranges are not optimizing as possible
>> phobosRange
>> import std: map, filter;
>
> How would you know the difference between phoboes complexity
> confusing the optimizer vs the 3-ness?
It's my conclusion from looking at the cgast vs asm. You can take
a look and I'm open to other reasons for this.
>
> ----
>
> 3 function ranges are good for sane api reasons even if slower,
> much less optional indexing allowing for binary search,
> allowing in-place sorts etc.
This is all possible if iteration uses one method. A single
method for iteration doesn't preclude other methods for other
purposes.
More information about the Digitalmars-d
mailing list