desy-ml / cheetah

Fast and differentiable particle accelerator optics simulation for reinforcement learning and optimisation applications.
https://cheetah-accelerator.readthedocs.io
GNU General Public License v3.0
30 stars 13 forks source link

Cache Screen reading #1

Closed jank324 closed 1 year ago

jank324 commented 2 years ago

Screen.reading is computed lazily when it is read. It is currently also computed every time that the property is read. This is bad as the histogram computation is quite expensive.

Solution: Cache the result of the histogram computation in separate variable and return that the next time Screen.reading is called.

jank324 commented 2 years ago

Fixed in 4f1c63c but might still require some testing.