luau icon indicating copy to clipboard operation
luau copied to clipboard

[COMPILER OPTIMIZATION] Simplify Conditional Logic Expressions

Open phoriah opened this issue 7 months ago • 0 comments

Compiler should optimize

do
    return value == "" and value
end

into

do
    return value == "" and ""
end

With locals the difference gap gets smaller for each optimize level until it's barely noticeable. With globals (GETGLOBAL|GETIMPORT) the difference stays noticeable on all optimize levels.

Likewise for the if-then-else expressions and any other conditional logic expressions

There's also a chance that similar logic can be applied to other places in code.

phoriah avatar Jul 09 '24 20:07 phoriah