Motivation
The implementation approach of envpool causes the compilation complexity to increase exponentially with the number of StateSpec instances. In my experiments, when the number of StateSpecs reaches 350, a release build takes approximately 1 hour or more, while a debug build may take over 10 hours. Even after I moved most of the code from .h files to .cc files to enable parallel compilation, the release build still takes 50 minutes.
Solution
I have simply modified the implementation of the Index template in tuple_utils.h, changing the original recursive specialization implementation to a fold specialization approach. Testing has shown that when the number of StateSpec instances is 350, the compilation time is reduced from 50 minutes to 14 minutes.
Additional context
I have submitted a PR to fix this issue #326
Checklist
Motivation
The implementation approach of envpool causes the compilation complexity to increase exponentially with the number of StateSpec instances. In my experiments, when the number of StateSpecs reaches 350, a release build takes approximately 1 hour or more, while a debug build may take over 10 hours. Even after I moved most of the code from .h files to .cc files to enable parallel compilation, the release build still takes 50 minutes.
Solution
I have simply modified the implementation of the Index template in
tuple_utils.h, changing the original recursive specialization implementation to a fold specialization approach. Testing has shown that when the number of StateSpec instances is 350, the compilation time is reduced from 50 minutes to 14 minutes.Additional context
I have submitted a PR to fix this issue #326
Checklist