Search in sources :

Example 1 with BaseSingleColumnSingleValueReader

use of com.linkedin.pinot.core.io.reader.BaseSingleColumnSingleValueReader in project pinot by linkedin.

the class ForwardIndexReaderBenchmark method singleValuedReadBenchMarkV1.

public static void singleValuedReadBenchMarkV1(File file, int numDocs, int columnSizeInBits) throws Exception {
    boolean signed = false;
    boolean isMmap = false;
    PinotDataBuffer heapBuffer = PinotDataBuffer.fromFile(file, ReadMode.heap, FileChannel.MapMode.READ_ONLY, "benchmark");
    BaseSingleColumnSingleValueReader reader = new com.linkedin.pinot.core.io.reader.impl.v1.FixedBitSingleValueReader(heapBuffer, numDocs, columnSizeInBits, signed);
    // sequential read
    long start, end;
    DescriptiveStatistics stats = new DescriptiveStatistics();
    for (int run = 0; run < MAX_RUNS; run++) {
        start = System.currentTimeMillis();
        for (int i = 0; i < numDocs; i++) {
            int value = reader.getInt(i);
        }
        end = System.currentTimeMillis();
        stats.addValue(end - start);
    }
    System.out.println(" v1 sequential read stats for " + file.getName());
    System.out.println(stats.toString().replaceAll("\n", ", ") + " raw:" + Arrays.toString(stats.getValues()));
    reader.close();
    heapBuffer.close();
}
Also used : DescriptiveStatistics(org.apache.commons.math3.stat.descriptive.DescriptiveStatistics) PinotDataBuffer(com.linkedin.pinot.core.segment.memory.PinotDataBuffer) BaseSingleColumnSingleValueReader(com.linkedin.pinot.core.io.reader.BaseSingleColumnSingleValueReader)

Aggregations

BaseSingleColumnSingleValueReader (com.linkedin.pinot.core.io.reader.BaseSingleColumnSingleValueReader)1 PinotDataBuffer (com.linkedin.pinot.core.segment.memory.PinotDataBuffer)1 DescriptiveStatistics (org.apache.commons.math3.stat.descriptive.DescriptiveStatistics)1