Repository navigation
Check a Lua build's native calls on one scan of its script - #1480
Merged
Merged
Conversation
Every Lua build checked its finished script for leaked hashtable natives and for __wurst_GetHandleId calls without a helper with two assertions, each of which lexed the whole text twice: once for the called names and once for the defined ones, the second testing for the function keyword at every character. One pass now collects both sets, and the build runs both checks on it. On a 9.4 MB script that is 150 to 250 ms cold instead of 600 ms (45 ms warm instead of 145 ms). The checks and their messages are unchanged.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Every Lua build checks its finished script for leaked hashtable natives and for
__wurst_GetHandleIdcalls without a helper definition. It did so with two assertions, each of which lexed the whole text twice: once for the called names and once for the defined ones, the second testing for thefunctionkeyword at every character. In a profile of an unoptimised build of a large map these scans were 4.7% of the compiler thread's samples.LuaAssertions.collectFunctionNamesnow collects both name sets in one pass, and the build callsLuaAssertions.assertNoLeakedNativeCalls, which runs both checks on it. The two single checks keep their signatures and messages.Measured
On that map's 9.4 MB script, in one JVM, alternating:
The emitted Lua of the map is byte-identical.
Verified
LuaTranslationTests.combinedNativeCallCheckRejectsWhatEitherCheckRejects: on ten scripts (calls, declarations, comments, strings, defined and undefined helpers, both failures at once) the combined check rejects exactly what the two checks reject, with the same message.LuaTranslationTestsandLuaHashtableTestspass locally (Windows). The change is in-memory text scanning, with no file or process handling.BACKLOG
A second commit records two measurements so they are not repeated:
forEachloops, which need a whole-program destruction proof; the straight-line version alone is not worth an analysis.