Should Disruptor be used only for POD data types?
i means that Disruptor<T> is only used for T with values ββsuch as byte[], int[], etc ?
I doubt that if we use T , which has Object references as its member variables, we need new member variables that will be on the heap. which again leads to cache misses, since a member variable can lie on a completely separate part of the heap.
So, do I believe that Disruptor<T> should only be used for T , which belongs to many simple static data types (PODs)?
Regards, Vimal
UPDATE: Can anyone else take a look at this question?
UPDATE2:
Reply to @Trisha
Hi Trisha,
Hey.
I saw the link you mentioned.
com.lmax.ticketing.api.Message inherits from javolution.io.Struct and consists of elements from javolution.io.Struct and javolution.io.Union , which allows Message interact between C/C++ for any class that inherits from javolution.io.Struct/Union , the memory layout is determined by the initialization order of the Struct/Union members and follows the same wordSize rules as C/C++ structs.
So, in essence, you have control over the memory layout of the elements that you put in Disruptor . And all members and subgroups of Message have a fixed size, that is, they do not have dynamic memory ( java.lang.Object )
In the same way, I want to say that we should use elements whose memory format we can control and not have any dynamic memory. And this is done to minimize cache misses.
Suppose if the message part was, say, java.lang.String , we donβt know where the JIT compiler would place this String. and if I access Message.String in EventHandler , this could lead to a cache miss, since String may be present in a completely different part of memory.
I'm right?