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

optimizations #207

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

optimizations #207

wants to merge 4 commits into from

Conversation

Aws0mee
Copy link
Contributor

@Aws0mee Aws0mee commented Sep 25, 2022

No description provided.

using table.IsEmpty seems to be 10% - 20% faster than checking table size
@wrefgtzweve
Copy link
Contributor

wrefgtzweve commented Sep 25, 2022

Instead of table.IsEmpty it might be better to just call next directly.
image
Also it might be great to localize these functions at the top of the file to prevent constantly having to access the global table for them.

@Aws0mee
Copy link
Contributor Author

Aws0mee commented Sep 25, 2022

Theoretically it would be slightly faster to just call next directly. However, in practice and with LuaJIT the difference is pretty much nonexistent. I figured most people would prefer to use table.IsEmpty() rather than not next() since it’s much more clear what the code is actually checking. Additionally, I don’t think many functions are localized at all so I could make another PR and localize some important ones if need be.

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.

None yet

2 participants