3 ms·
Not a scientific test: var fs = require(‘fs’), csv = require(‘csv-parser’); var start = new Date().getTime(); fs.createReadStream(‘./Batting.csv’)
by iamleppert 9y ago
Not a scientific test:
var fs = require(‘fs’),
csv = require(‘csv-parser’);
var start = new Date().getTime();
fs.createReadStream(‘./Batting.csv’)
.pipe(csv())
.on(‘data’, function() {})
.on(‘end’, function() {
console.log(new Date().getTime() — start);
});
This takes about 400 ms on my machine to parse a 6.1 MB CSV (15.25 MB/s). I didn’t do anything useful with the data, but I did verify it exercises the parsing function.
Clearly all the work/time is spent in the actual parsing and handling corner-cases in CSV trying to be correct over high performance/throughput.