Skip to content

Optimize for loops over spans  #6195

@forki

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions