Skip to content

Optimize for loops over spans  #6195

Description

@forki

Consider the following example:

let x : Span<'T> = ...
for item in x do
    ...

Using the for loop against the span x, it will use the enumerator to iterate. This is inefficient and can be optimized by the compiler to simply iterate by the indexer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions