This content has been marked as final. Show 4 replies
There are specific serialization functions (I'm talking about POF) for writing arrays and collections. I tend to use ArrayLists, as they're easy to manipulate, fast, and have direct equivalents in both C# and C++.
Your container choice will always be overshadowed by the cost of class deserialization. I don't know enough about the particulars of what you're dong. However if you're running code in the grid, you might want to consider operating directly on the binary (POF serialized form). This is a slightly more involved process, especially when it comes to collections, however will yield the fastest results.
I access the Cache member from an Entry Processor.
One thing I've noticed is the first time a the PofCollection segment is accessed (repeatedly calling getChild(n) api),
it takes somewhat longer then when i come back and repeat the same exact operation.
So was wondering if the Collection (java.util.ArrayList right now) is getting optimized to something else and I could use that itself from the beginning to get consistent response times.
Here it is :
Inside my EntryProcessor class :
Extract PofValue from BinaryEntry (obtained from BackingMap, BinaryEntry is the Cached PofObject)
return first 1000 elements from the CachedObject.
List<T> payload = new ArrayList<T>(1000);
for (int i = 0; i < 1000 ; i++ )
payload.add((T) ((PofCollection) pofValue).getChild(index).getValue());
Pls. let me know if i need to clarify etc.