How to speed up a simulation