-
Notifications
You must be signed in to change notification settings - Fork 66
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
Specialize table access operations for short string keys #100
Comments
Introduced new bytecodes GETTABLE_SK, SELF_SK and SETTABLE_SK that are emitted when we do not know that the variable is a table - but the key is known to be a short string constant. This covers the many uses of tables. Implementation wise only the interpreter has been enhanced for GETTABLE_SK right now (release 0.17) - work in JIT is still pending. These bytes code default to the standard bytecodes in JIT. Also had to put a workaround in listcode() to emit old opcode names to avoid tests failing. |
A related optimisation is to encode the table subtypes in the same way as number, function and string subtypes are defined as 1-2 bit variant flags. I think this will improve performance as currently another field in the structure is inspected to determine whether the type is array type. |
… in the lua value similar to how integer and number values are handled
…en operand of OP_SELF is known to be a short string
Fixed in 0.18 - more work can be done but will be tracked separately |
This is a common usage in Lua - and we already specialize when the variable is known to be table type (declared as a table) and the key is a short string. But even when the variable is not known to be a table type, if we know that the key is a short string then we could generate a more optimized version of the table get / set operation.
The text was updated successfully, but these errors were encountered: