Skip to content

The repeat block can probably be faster #291

@GarboMuffin

Description

@GarboMuffin
for (var a0 = 10; a0 >= 0.5; a0--) {

}

There's room to do better:

  • if we know that the number of iterations is an integer, rounding rules don't matter at all, just compare against 0
    • repeating constant integer times and repeating length of list times are common operations that might benefit
  • for when we can't tell if it's an integer at compile time, it might be better to round at the start of the loop instead of comparing against 0.5 on each iteration
    • i am not entirely convinced that this would be faster in the general case as I believe I tried it in forkphorus a long time ago and ended up not keeping it

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceIdeas for improving performance

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions