Repository navigation
Compilation time improvements for PolymodBaseClassMacro - #523
Conversation
|
I'll test this out when I'm home and update this with my personal results, the only thing I'm wondering is do you know why HL build actions are failing? That's the only thing I'm personally concerned about |
There was a problem hiding this comment.
Clean compile for me took 10 minutes 36.1 seconds. (Base is surprisingly 9 minutes and 56.8 seconds)
Warm compile for me took 2 minutes and 1.6 seconds. (Base 2 minutes 30 seconds)
A definite improvement (for warm compiles, at least from me), although still super slow.
|
Finally man we needed this |
There was a problem hiding this comment.
Note: This results are tested within Funkin` public-playtest
Develop:
- Debug (Clean):
PolymodBaseClassMacro.buildBaseClass- 10.265s- Build Time - 2m 32.1s
- Debug (Warm):
PolymodBaseClassMacro.buildBaseClass- 10.045s- Build Time - 1m 5.7s
- Release (Clean):
PolymodBaseClassMacro.buildBaseClass- 10.943s- Build Time - 6m 46.9s
- Release (Warm):
PolymodBaseClassMacro.buildBaseClass- 9.888s- Build Time - 1m 8s
This PR:
- Debug (Clean):
PolymodBaseClassMacro.buildBaseClass- 1.031s (holy shit)- Build Time - 2m 21.3s
- Debug (Warm):
PolymodBaseClassMacro.buildBaseClass- 1.008s- Build Time - 57s
- Release (Clean):
PolymodBaseClassMacro.buildBaseClass- 1.007s- Build Time - 6m 21.6s
- Release (Warm):
PolymodBaseClassMacro.buildBaseClass- 1.215s (second attempt: 0.957s)- Build Time - 58.2s (second attempt: 52.3s)
|
OKAY? Yeah maybe it's a bit of a bad idea.. I'm wondering what specifically the inline calls are from |
JackXson-Real
left a comment
There was a problem hiding this comment.
Went from 2:38 to 1:53 on non-clean compiles!
…riptBridge to reduce generated code
…rrides can be inlined again
…of resubmitting them unchanged
…ing every superclass's fields
…educe generated code
These classes are generally used as simple data containers (like Vectors and Matrices)
021e02f to
802ec5a
Compare





This PR makes several changes to the PolymodBaseClassMacro to improve readability and performance. The changes are focused primarily around optimizing the length of the macro expressions inserted into every class, since if any of these expressions are long or have complicated typing, the effect is multiplied since this macro injects itself into every class.
Lookups to locate the PolymodScriptClass are now done in a static function in PolymodScriptBridge. This drastically reduces the complexity of the macro expression, which is important considering that this expression is currently replacing the expression for every function in every class in the project. Reducing roughly forty lines of Haxe down to two dramatically improves the typing step.
scriptInit()now always callsPolymodScriptBridge.instantiate(). The code is functionally the same, while being a single line of Haxe instead of 30+. This reduces the amount of code that needs to be typed for every class, improving build performance.buildBaseClass()was callingContext.getBuildFields()every time, and returning the list unmodified if a class were to be skipped by the macro. This is redundant, since you can simply returnnullto have Haxe continue normally, reducing macro time by not having to compile the list of build fields for every class.removeInlinedFunctionCalls()has been removed entirely. Since the first change means the macro no longer includes a return in a while loop, we no longer impose a non-final return on every function.The
@:hscriptAscRootmetadata is added to the class that has had the_ascfield added to it. The macro then checks itself and its parents for that metadata instead of callingcls.findField(); this rewritten check is cheaper than the previous one.The benchmarks I ran showed build times reducing by about 10-15 seconds, with most of the savings being in the execution of
buildBaseClasswith smaller savings in the typing and C++ code generation steps.