Skip to content

Conversation

@ptersilie
Copy link
Contributor

@ptersilie ptersilie commented Apr 23, 2025

This PR adds promotion for big constants in Lua's arithmetic operations. For this we change op_arithK by inlining op_arith_aux and adding yk_promote to the second operand.

Using the following lua program I can confirm that this indeed promotes big constants:

local sum = 0
for _ = 1,100000 do
    sum = sum + 420000
end
print(sum)

However, when running yk-benchmarks I cannot see any significant performance improvements. On the contrary bigloop and permute take a 10% performance hit. Looking into bigloop I cannot figure out where this performance hit comes from as the jit-asm of both traces is nearly identical, and YKD_STATS tells us that it is indeed trace execution that takes the hit. I've attached the output for a normal run of bigloop and a run with the new promote code, printing out jit-pre-op, jit-asm, and YKD_STATS.

NORMAL.txt
PROMOTEK.txt

@ltratt
Copy link
Contributor

ltratt commented Sep 15, 2025

Is that the right PR / issue for this comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants