folding into direct buffers is faster

This commit is contained in:
Xavier Léauté 2014-03-26 17:13:41 -07:00
parent 83ac1d323e
commit c92fd6f45d
1 changed files with 3 additions and 2 deletions

View File

@ -66,10 +66,11 @@ public class HyperUniquesBufferAggregator implements BufferAggregator
@Override
public Object get(ByteBuffer buf, int position)
{
ByteBuffer dataCopyBuffer = ByteBuffer.allocate(HyperLogLogCollector.getLatestNumBytesForDenseStorage());
ByteBuffer dataCopyBuffer = ByteBuffer.allocateDirect(HyperLogLogCollector.getLatestNumBytesForDenseStorage());
ByteBuffer mutationBuffer = buf.duplicate();
mutationBuffer.position(position);
mutationBuffer.get(dataCopyBuffer.array());
dataCopyBuffer.put(mutationBuffer);
dataCopyBuffer.rewind();
return HyperLogLogCollector.makeCollector(dataCopyBuffer);
}