I wonder if changing the code to the following will help much?
import os, parsecsv, streams
proc main() =
var
fields = 0'i32
csv: CsvParser
let
stream = newFileStream(paramStr(1), fmRead)
csv.open(stream, paramStr(1))
while csv.readRow():
inc(fields, csv.row.len())
csv.close()
echo(fields)
main()
Making sure that fields is a 32 bit integer and wrapping the main body in a function can help speed things up a little usually.
