Skip to content

Apply fusion optimization to input iterator#75

Merged
patrickroberts merged 1 commit into
mainfrom
input-iterator-fusion-optimization
Jun 6, 2026
Merged

Apply fusion optimization to input iterator#75
patrickroberts merged 1 commit into
mainfrom
input-iterator-fusion-optimization

Conversation

@patrickroberts

Copy link
Copy Markdown
Collaborator

This change is made to expand the scope of a fused dispatch optimization based on the understanding that input iterators model the semantic requirement *i is equality-preserving, which is to say that two evaluations of this expression with the same input must have equal outputs.

This is why, for example, std::ranges::istream_view<Val> caches Val.

@patrickroberts patrickroberts marked this pull request as draft June 1, 2026 17:54
@patrickroberts patrickroberts force-pushed the input-iterator-fusion-optimization branch from bc3a294 to 97ff50b Compare June 2, 2026 05:28
@coveralls

coveralls commented Jun 2, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 81.25% (+0.3%) from 80.934% — input-iterator-fusion-optimization into main

@patrickroberts patrickroberts force-pushed the input-iterator-fusion-optimization branch from 97ff50b to af0f7d0 Compare June 2, 2026 05:54
@patrickroberts patrickroberts force-pushed the input-iterator-fusion-optimization branch from af0f7d0 to 02d0090 Compare June 2, 2026 06:06
@patrickroberts patrickroberts marked this pull request as ready for review June 2, 2026 06:13

@foonathan foonathan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked into your implementation, but I can confirm that you are allowed to cache an input iterator: https://eel.is/c++draft/iterator.concept.readable#2

auto a = *it;
auto b = *it;
assert(a == b); // always true

@patrickroberts patrickroberts merged commit 9b20b85 into main Jun 6, 2026
78 checks passed
@patrickroberts patrickroberts deleted the input-iterator-fusion-optimization branch June 6, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants