Open moorepants opened 10 months ago
To clarify:
python ocp.py
python ocp.py
shows the speed up on the second run but:
$ ipython
run ocp.py
run ocp.py
didn't.
Bjorn pointed out to me that a version of pycompilation is in sympy/utilities/_compilation.
I have it working but I don't know if it caches the compiled code.
In the sympy version the import_module_from_file
has a kwarg only_if_newer_than
. It may be a way to import an old complied version if some dependent files haven't changed.
SymPy includes pycompilation (private modules), so we could just use it from SymPy instead of the standalone package.
The pycompilation caching seems to work. On the problem in https://github.com/brocksam/muscle-driven-bicycle-paper if I run the optimal control script twice in a row, the second run takes no time for the compilation step taking total time to instantiate the problem from 180 seconds to 54 seconds (approximately).
I did notice that if I open IPython and run the script twice in a row that the cached compilation did not seem to load (always took 180 seconds to complete). Not sure why.