Skip to content

using a (item () of ()) list block in other blocks that expect number values; the code can be optimized #310

@52525rr

Description

@52525rr
Image

this compiles to

((+(b0.value[1 - 1] ?? "") || 0) + 0)

but since undefined is a falsy value this could be optimized to

((+b0.value[1 - 1] || 0) + 0)

this can also be applied for list indexing where the compiler knows the index should be a number.

Image

generates

((+(b0.value[(((+b1.value || 0) + 0) | 0) - 1] ?? "") || 0) + 0)

but similarly can be optimized to

((+b0.value[(((+b1.value || 0) + 0) | 0) - 1]  || 0) + 0) 

for list indexing where the compiler doesnt know that the index is a number, perhaps another version of listGet is created that doesnt do the nullish check.

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