Optimize lualib functions#1217
Merged
Perryvw merged 7 commits intoTypeScriptToLua:masterfrom Apr 2, 2022
Merged
Conversation
Contributor
|
Super excited for this! Well done glass! |
3e8be7f to
fce4580
Compare
fce4580 to
4a68d9c
Compare
Perryvw
reviewed
Apr 2, 2022
Perryvw
approved these changes
Apr 2, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimizes lualib functions.
Also fixes #1130.
Depends on #1213, however it can be made independent.Array.push with only 1 argument gets even more optimization, as it is very common:
array[#array + 1] = elArrayPushArrayto avoid unpacking/repacking the array.Benchmarks on my machine show 10-70% time reduction for most functions on lua5.3 and luajit. As can be expected, lua5.3 has better relative improvement for many functions compared to luajit.
Some optimization methods
for i in rangeloop to iterate arrays