You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It takes a very long time for the C compiler to run on large files like ExprNodes.py and Nodes.py. This is seen in the CI -all tests repeatedly timing out (although partly this is because we can't compile them in parallel on Python 2.7)
One possible indicator is the warning from gcc:
note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
(although that could potentially be toggled independently or the limit increased)
Obviously it's inevitable that a big Cython file will generate a big C file and that a big C file will take a while to compile, but potentially we could do better.
Second, I tried to split each stat at module-level into a separate function (Split up module init function #4386). This gave appreciable speed-ups for large modules. However the PR was very intended as a proof of concept with little attention to code quality....
I think a variant of the second approach is probably worthwhile. My current thought that we shouldn't do it on a "per-stat" basis but maybe give each class creation a separate function (that's easy to do for cdef classes, slightly harder for regular classes). That would likely give the appropriate granularity and keep things grouped in logical units.
Describe the bug
It takes a very long time for the C compiler to run on large files like ExprNodes.py and Nodes.py. This is seen in the CI
-alltests repeatedly timing out (although partly this is because we can't compile them in parallel on Python 2.7)One possible indicator is the warning from gcc:
(although that could potentially be toggled independently or the limit increased)
Obviously it's inevitable that a big Cython file will generate a big C file and that a big C file will take a while to compile, but potentially we could do better.
There's a few gcc flags to try to profile compilation time (https://stackoverflow.com/questions/13559818/profiling-the-c-compilation-process), and they suggest that the module init function (where all the module-level user code goes) is the main culprit (unsurprisingly)
Environment (please complete the following information):
Additional context
I tried a couple of approaches to fix the problem.
I think a variant of the second approach is probably worthwhile. My current thought that we shouldn't do it on a "per-stat" basis but maybe give each class creation a separate function (that's easy to do for
cdefclasses, slightly harder for regular classes). That would likely give the appropriate granularity and keep things grouped in logical units.Improvements made to mitigate this in Cython 3.1
More efficient string constant storage:
Shorter code generation:
More efficient code object creation that no longer permanently stores tuples in the global module state: