开发者

LinkedBlockingQueue and primitives

开发者 https://www.devze.com 2023-04-13 09:47 出处:网络
I have need for a LinkedBlockingQueue but what I am passing primitives to it.My data rates for adding to the Queue are about 4ms or 256 data points per sec.The issue that I am having is the data start

I have need for a LinkedBlockingQueue but what I am passing primitives to it. My data rates for adding to the Queue are about 4ms or 256 data points per sec. The issue that I am having is the data starts to delay immediately on start but over time it seems the JIT makes this more efficient and it ends up real time. I am trying to figure out where I need to decrease the initial delay and one of them is the "newing" up a Float object from autoboxing on each insert in the Queue. Does anyone have a LinkedBlockingQueue using primitives?

Or is there something faster than LinkedBlockingQueue when yo开发者_StackOverflowu aren't sure of the sizes and using primitives?


Though your data isn't really large enough to warrant better data structures, the Fastutil library is exactly what you're looking for. It's collections that are fast and low memory footprint, and they have versions for each Java primitive.

They don't have implementations for blocking, but you should be able to extend their classes to add their functionality.

0

精彩评论

暂无评论...
验证码 换一张
取 消