Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unnecessary boxing and unboxing in the generated code #13

Open
mjanicek opened this issue Oct 24, 2016 · 0 comments
Open

Avoid unnecessary boxing and unboxing in the generated code #13

mjanicek opened this issue Oct 24, 2016 · 0 comments

Comments

@mjanicek
Copy link
Owner

The compiler currently requires all local and temporary variables to be boxed. This introduces a significant performance penalty.

For instance, in the following snippet:

local x = 0
for i = 1, 10 do
  x = x + i
end

every arithmetic operation with x or i involves unboxing it, performing the operation, and boxing the result again. Boxing here is not necessary: it can be determined statically that x is and i are integers, so they can be replaced with primitives while maintaining semantics.

How to go about this

The required static type analysis is already in place. The only remaining thing to do is to change the layout of the generated code to support unboxed local variables and temporaries, and wire the operations up accordingly.

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

No branches or pull requests

1 participant