Repository navigation
Compile-time natives: no per-call strings or keys, field writes by field, object files serialised once - #1449
Merged
Merged
Conversation
…eld, object files serialised once - ReflectionNativeProvider turned every argument of every native call into a string for an error message it builds only on failure, decoding each interpreter string, and copied the method's parameter types each time. NativeJassFunction keeps them. - ReflectionBasedNativeProvider, which serves the object editing natives, allocated and hashed a (name, arity) pair per call. It looks the method up by name and then by arity. - A field write went through every mod of the object to find the old values of the field; an ability with many levels has thousands. The object keeps its mods by field, so only those of the field are looked at. - The writeback serialised each object file to hash it and again to write it, and hashed the copy in the map to compare. It serialises once, hashes once for the manifest and compares the map's copy byte by byte. SurvivalChaosReborn, with #1448: compile-time functions execute about 2.4 to 2.0 s (median of 3). Output and exported object data identical.
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.
Costs of the object editing natives and the object writeback, found profiling a large map with thousands of compile-time functions:
ReflectionNativeProvider.invoketurned every argument of every native call into a string ("" + args[i]) for an error message it builds only on failure; for an interpreter string that decodes its bytes. It also copied the method's parameter types (getParameterTypesclones) each call.NativeJassFunctionkeeps the types and the name offset; the message uses the argument when it fails.ReflectionBasedNativeProvider, which serves the object editing natives, allocated and hashed aPair(name, arity)per call. It looks the method up by name, then by arity.CompiletimeNatives.modifyObjectwent through every mod of the object to find the old values of the field (8 % of the compile-time samples); an ability with many levels has thousands. wc3libs'Objkeeps its mods by field (getModsOfField, kept in step byaddMod,removeand the object file reader), so only the field's are looked at. Same mods removed, same order.ProgramStateIO.writeBackserialised each object file to hash it and again to write it, and MD5-hashed the copy in the map to compare. It serialises once, hashes once for the manifest, and compares the map's copy withArrays.equals.The same map, on top of #1448 (measured together, alternating against #1448 alone): compile-time functions execute about 2.4 to 2.0 s (median of 3; noisy).
02_compiled.j.txtidentical apart from the version line, exported object data (WurstExportedObjects_*.wurst.txt) identical.Behaviour is unchanged, so no new test; CompiletimeNativesTest (field replacement across levels and data pointers, mods read from the map file, writeback across runs), ExportToWurstTest, ObjectExportServiceTest, CompiletimeTests, CompiletimeHashtableTests, InterpreterTests, StdLibStringTests and NewFeatureTests pass.