Skip to content

Don't use Array.length in loop conditions #6

@hampelm

Description

@hampelm

Per @mr0gorg's comment:

"In most engines, Array.length is calculated dynamically, so you should never use it in the loop's condition during performance-sensitive operations. Something like this is often much faster:

for (var i = 0, len = features.length; i < len; i++) {

This way, the length value is pre-computed and cached in len."

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions