Mayitzin / ahrs

Attitude and Heading Reference Systems in Python

Home Page:https://ahrs.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

HicaroD opened this issue · comments

Those copies can be quite inneficient and it looks useless:

ahrs/ahrs/filters/ekf.py

Lines 1107 to 1108 in 761ff0e

self.gyr = np.copy(self.gyr)
self.acc = np.copy(self.acc)

Same for magnetometer here:

self.mag = np.copy(self.mag)

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.