Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simpler slice Iterator methods #72166

Merged
merged 2 commits into from
May 16, 2020

Commits on May 13, 2020

  1. Use simpler impls for some Iterator methods for slices.

    The default implementations of several `Iterator` methods use `fold` or
    `try_fold`, which works, but is overkill for slices and bloats the
    amount of LLVM IR generated and consequently hurts compile times.
    
    This commit adds the simple, obvious implementations for `for_each`,
    `all`, `any`, `find`, `find_map`, and simplifies the existing
    implementations for `position` and `rposition`. These changes reduce
    compile times significantly on some benchmarks.
    nnethercote committed May 13, 2020
    Configuration menu
    Copy the full SHA
    5a0ac05 View commit details
    Browse the repository at this point in the history
  2. Change Iterator::nth to use self.next() in a while loop.

    Currently it uses `for x in self`, which seems dubious within an
    iterator method. Furthermore, `self.next()` is used in all the other
    iterator methods.
    nnethercote committed May 13, 2020
    Configuration menu
    Copy the full SHA
    3b10858 View commit details
    Browse the repository at this point in the history