Commit 186ae72
Benjamin Moody
SignalMixin.smooth_frames: assorted optimizations.
The variable tspf is not used and can be removed.
sig_len can be calculated using // rather than / and truncating to an
integer (the latter could be incorrect for records longer than 2**53.)
The output array can be allocated using np.empty instead of np.zeros
since it will be fully initialized by the subsequent loop.
Since each frame is independent of the others, the loop can be broken
up into blocks (here, arbitrarily chosen as 2**16 frames) to reduce
temporary memory usage while still spending most of our CPU time in
numpy operations.1 parent 6db9ebf commit 186ae72
1 file changed
+11
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
827 | 827 | | |
828 | 828 | | |
829 | 829 | | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | 830 | | |
834 | 831 | | |
835 | 832 | | |
| |||
854 | 851 | | |
855 | 852 | | |
856 | 853 | | |
857 | | - | |
| 854 | + | |
858 | 855 | | |
859 | 856 | | |
860 | 857 | | |
| |||
868 | 865 | | |
869 | 866 | | |
870 | 867 | | |
871 | | - | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
872 | 873 | | |
873 | 874 | | |
874 | 875 | | |
875 | 876 | | |
876 | 877 | | |
877 | 878 | | |
878 | | - | |
879 | | - | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
880 | 884 | | |
881 | 885 | | |
882 | 886 | | |
| |||
0 commit comments