private void clearEntryIndices(int entryCount) { verify(entryCount <= entryIndicesList.length); for (int i = 0; i < entryCount; i++) { entryIndicesList[i].clear(); } }
@Override public synchronized void accept(Page page) { // reset the assignment lists for (IntList partitionAssignment : partitionAssignments) { partitionAssignment.clear(); } // assign each row to a partition for (int position = 0; position < page.getPositionCount(); position++) { int partition = partitionGenerator.getPartition(page, position); partitionAssignments[partition].add(position); } // build a page for each partition Block[] outputBlocks = new Block[page.getChannelCount()]; for (int partition = 0; partition < buffers.size(); partition++) { IntArrayList positions = partitionAssignments[partition]; if (!positions.isEmpty()) { for (int i = 0; i < page.getChannelCount(); i++) { outputBlocks[i] = page.getBlock(i).copyPositions(positions.elements(), 0, positions.size()); } Page pageSplit = new Page(positions.size(), outputBlocks); memoryManager.updateMemoryUsage(pageSplit.getRetainedSizeInBytes()); buffers.get(partition).accept(new PageReference(pageSplit, 1, () -> memoryManager.updateMemoryUsage(-pageSplit.getRetainedSizeInBytes()))); } } }
@Override public void clear() { list.clear(); } @Override
@Override public void clear() { mapping.clear(); }
/** * Empties all the data from this postings list making it ready to be reused. */ public void clear() { documentPointersDifferential.clear(); count = 0; counts.clear(); maxCount = 0; occurrences = 0; if(positions != null){ positions.clear(); lastPosition = -1; sumMaxPos = 0; } firstDocumentPointer = -1; lastDocumentPointer = -1; frequency = 0; }
private void clearEntryIndices(int entryCount) { verify(entryCount <= entryIndicesList.length); for (int i = 0; i < entryCount; i++) { entryIndicesList[i].clear(); } }
private void clearEntryIndices(int entryCount) { verify(entryCount <= entryIndicesList.length); for (int i = 0; i < entryCount; i++) { entryIndicesList[i].clear(); } }
// You could get primitive lists from fastutil, gs, hppc or trove LongList keysToPut = keysToPutThreadLocal.get(); keysToPut.clear(); IntList valuesToPut = valuesToPutThreadLocal.get(); valuesToPut.clear(); for (LongIntCursor cur = map.cursor(); cur.moveNext();) { long key = cur.key(); int value = cur.value(); if (checkSomething(key, value)) { cur.remove(); // remove the entry } else { // want to insert a <newKey, newValue> entry keysToPut.add(newKey); valuesToPut.add(newValue); } } // bulk insert for (int i = 0, toPut = keysToPut.size(); i < toPut; i++) { map.put(keysToPut.get(i), valuesToPut.get(i)); }
@Override public synchronized void accept(Page page) { // reset the assignment lists for (IntList partitionAssignment : partitionAssignments) { partitionAssignment.clear(); } // assign each row to a partition for (int position = 0; position < page.getPositionCount(); position++) { int partition = partitionGenerator.getPartition(page, position); partitionAssignments[partition].add(position); } // build a page for each partition Block[] outputBlocks = new Block[page.getChannelCount()]; for (int partition = 0; partition < buffers.size(); partition++) { IntArrayList positions = partitionAssignments[partition]; if (!positions.isEmpty()) { for (int i = 0; i < page.getChannelCount(); i++) { outputBlocks[i] = page.getBlock(i).copyPositions(positions.elements(), 0, positions.size()); } Page pageSplit = new Page(positions.size(), outputBlocks); memoryManager.updateMemoryUsage(pageSplit.getRetainedSizeInBytes()); buffers.get(partition).accept(new PageReference(pageSplit, 1, () -> memoryManager.updateMemoryUsage(-pageSplit.getRetainedSizeInBytes()))); } } }
@Override public synchronized void accept(Page page) { // reset the assignment lists for (IntList partitionAssignment : partitionAssignments) { partitionAssignment.clear(); } // assign each row to a partition for (int position = 0; position < page.getPositionCount(); position++) { int partition = partitionGenerator.getPartition(page, position); partitionAssignments[partition].add(position); } // build a page for each partition Block[] outputBlocks = new Block[page.getChannelCount()]; for (int partition = 0; partition < buffers.size(); partition++) { IntArrayList positions = partitionAssignments[partition]; if (!positions.isEmpty()) { for (int i = 0; i < page.getChannelCount(); i++) { outputBlocks[i] = page.getBlock(i).copyPositions(positions.elements(), 0, positions.size()); } Page pageSplit = new Page(positions.size(), outputBlocks); memoryManager.updateMemoryUsage(pageSplit.getRetainedSizeInBytes()); buffers.get(partition).accept(new PageReference(pageSplit, 1, () -> memoryManager.updateMemoryUsage(-pageSplit.getRetainedSizeInBytes()))); } } }
runtimeIndex.clear();