Hi,
I have recently used the moving averages function in BFL, and found that the time complexity is related to the size of the window for which the moving average is computed. Based on the window sizes, these are the readings for server processing time I got for a column table with 5.9 million rows. I got this by following the recipe given in the BFL documentation (only replacing the input column table passed to the MA procedure by other contents).
Window Size | Seconds |
2 |
|
10 |
|
50 |
|
100 |
|
200 |
|
500 |
|
1000 |
|
5000 |
|
This implementation does not at all seem optimal; I think that it should use a standard incremental algorithm, which is independent of the window size. In such an algorithm, you'd keep a running sum of elements for a window size, and at each step, simply subtract the oldest element and add the new element to the sum. You'd then return the result of division by the window size as the average.
Another problem seems to be that I always get the result to be an integer, even when my numbers are real. Is there a way around this?
Thanks.