Hacker News new | ask | show | jobs
by mtsr 2231 days ago
Since you generally want to keep a set number of time steps the commonly used data structure for this is a ring buffer. No garbage and all you do is increment the index (with wraparound) every step.

Not a lot of technical details, but this video has a great general overview https://www.youtube.com/watch?v=W3aieHjyNvw