RMS measurement/calculation On-the-fly
Keep the data stored in a circular buffer, and keep a pointer to the current value.  Keep a running squared total.  At each sample, subtract the squared value that "falls off" your buffer, and add the squared value that adds on.  To get the new sum squared, its then two squarings, and add and a subtract, regardless of how big your buffer is.  You're still on the hook for the square root, though.

For efficiency in the modulo math for the circular buffer, I suggest a buffer size of a power of 2.