symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.44k stars 147 forks source link

Jinja seems to be taking longer than it should be #112

Closed bradley-solliday-skydio closed 2 years ago

bradley-solliday-skydio commented 2 years ago

This can be seen when generating code in the python optimizer (though I imagine it can be seen just about anywhere Codegen objects are used to generate functions).

Perhaps something can be done to speed it up.

Here is a profile of symforce_py_optimizer_test.py, modified to generate 1000 distinct priors: image image image

bradley-solliday-skydio commented 2 years ago

This has been sped up. Also, now only a tiny fraction of the time is spent in jinja functions (and instead almost all the time is spent in codegen functions): image image