标题翻译
Efficient way to save last X amount of integers
问题
我获取各种数据,每秒更新一次。我需要编写一个函数,以给我某个属性最近 30 个值(最近 30 秒)的值。什么方法在占用内存最少的情况下保存最近 30 个值?30 秒之前的所有数据都可以丢弃。我需要每秒执行此操作 96,000 次。
英文翻译
I get all kinds of data, which gets updated every second. I need to write a function that gives me the last 30 values (of the last 30 seconds) of a certain attribute. What would be the most memory-efficient way to save the last 30 values of something? Everything older than 30 seconds can be discarded. I have to do this action 96k times/second.
专注分享java语言的经验与见解,让所有开发者获益!
评论