Open setaperlacloche opened 3 years ago
Would you be willing to submit a PR for this?
Any news on this ? I am running 502 LEDs in total but limited the # to 256 in case of performance issues on a RP3B. I am looking for any performance boost I can have to get rid of that lags.... Thanks for all the support, You all do an outstanding job :-)
Context
I studied a lot this part of code (visualization.py:206-222):
And I tried to profile each line of this code. I discovered that the call to
gaussian_filter1d
represents 40% of the time of this piece of code, whilemel
variable is an 1D array with only 24 items (!).gaussian_filter1d performance is poor
My guess :
gaussian_filter1d
needs some heavy precomputing to elaborate filter coefficients, but at every call this heavy computing is done again and again. Asgaussian_filter1d
is a linear function (gaussian_filter1d(a+b) == gaussian_filter1d(a) + gaussian_filter1d(b)
), it's possible to extract filter coefficients and fill a cache for future use. So I suggest the following class :Bench results:
Before:
After:
Conclusion : Speed x29
Note :
gaussian_filter1d
is used several times in this project : in MEL computing and in visualize_* functions.