[erlang-questions] Speed of CSV parsing: how to read 1M of lines in 1 second

Max Lapshin max.lapshin@REDACTED
Tue Mar 27 11:44:46 CEST 2012

I'm experimenting more and found very strange thing

sscanf((char *)start, "%4d%02d%02d", &year, &month, &day);

this adds 3 microseconds per line. Why?? I've changed it to macros:
#define D2(s) (((s)[0] - '0')*10 + ((s)[1] - '0')) and this macros
works for several nanoseconds.

Is sscanf really so slow??

And also I'll really have to cache somehow timestamps, because timegm
takes more than 200 microseconds per line. It is impossible to call it
on each line.

More information about the erlang-questions mailing list