Mayitzin / ahrs

Attitude and Heading Reference Systems in Python
https://ahrs.readthedocs.io/
MIT License
564 stars 89 forks source link

performance: probably unnecessary array copies in `_compute_all` method from `EKF` class #105

Open HicaroD opened 11 months ago

HicaroD commented 11 months ago

Those copies can be quite inneficient and it looks useless: https://github.com/Mayitzin/ahrs/blob/761ff0eff022d9b3a0c7e7eb58d0d038c5606355/ahrs/filters/ekf.py#L1107-L1108

Same for magnetometer here: https://github.com/Mayitzin/ahrs/blob/761ff0eff022d9b3a0c7e7eb58d0d038c5606355/ahrs/filters/ekf.py#L1117

HicaroD commented 10 months ago

image

I've used Scalene to profile my code which uses ahrs in order to filter sensor data, and I noticed in the left side, more especifically in the yellow column, that I'm doing 13 MB/s of copies in the line where I instantiate EKF.