use of com.univocity.parsers.common.processor.AbstractRowProcessor in project mapping-benchmark by arnaudroger.
the class UnivocityCsvParserBenchmark method parseCsv.
@Benchmark
public void parseCsv(Blackhole blackhole, CsvParam csvParam) throws IOException {
CsvParserSettings settings = new CsvParserSettings();
// turning off features enabled by default
settings.setIgnoreLeadingWhitespaces(false);
settings.setIgnoreTrailingWhitespaces(false);
settings.setSkipEmptyLines(false);
settings.setColumnReorderingEnabled(false);
settings.setReadInputOnSeparateThread(false);
settings.setRowProcessor(new AbstractRowProcessor() {
@Override
public void rowProcessed(String[] row, ParsingContext context) {
blackhole.consume(row);
}
});
com.univocity.parsers.csv.CsvParser parser = new com.univocity.parsers.csv.CsvParser(settings);
try (Reader reader = csvParam.getReader()) {
parser.parse(reader);
}
}
use of com.univocity.parsers.common.processor.AbstractRowProcessor in project mapping-benchmark by arnaudroger.
the class UnivocityConcurrentCsvParserBenchmark method parseCsv.
@Benchmark
public void parseCsv(Blackhole blackhole) throws IOException {
CsvParserSettings settings = new CsvParserSettings();
// turning off features enabled by default
settings.setIgnoreLeadingWhitespaces(false);
settings.setIgnoreTrailingWhitespaces(false);
settings.setSkipEmptyLines(false);
settings.setColumnReorderingEnabled(false);
settings.setReadInputOnSeparateThread(true);
settings.setRowProcessor(new AbstractRowProcessor() {
@Override
public void rowProcessed(String[] row, ParsingContext context) {
blackhole.consume(row);
}
});
com.univocity.parsers.csv.CsvParser parser = new com.univocity.parsers.csv.CsvParser(settings);
try (Reader reader = CsvParam.getSingleThreadedReader(quotes, nbRows)) {
parser.parse(reader);
}
}
Aggregations