Skip to content

Conversation

@caelumable
Copy link

if (begin != nullptr && user_cmp->Compare(file_start, user_begin) < 0) {
  user_begin = file_start;
  inputs->clear();
  i = 0;
 } else if (end != nullptr &&
           user_cmp->Compare(file_limit, user_end) > 0) {
  user_end = file_limit;
  inputs->clear();
  i = 0;
}

If the range of user_begin and user_end is [c, d] while the range of file_start and file_limit is [a, g], this would result in two scope expansions: first expanding user_begin and user_end to [a, d], and then further expanding them to [a, g], thereby increasing the number of loop iterations.

Removing this else clause would allow completing the scope expansion in a single step by directly adjusting user_begin and user_end to [a, g].

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.

1 participant