Typically if I’m reading text from a file that I want to parse, say a .csv file I’ve used a combination of an ifstream
, std::getline
and then a std::stringstream
to parse the line into words or entries. Inspired by a suggestion in the c++ help discord I tried using std::string
functions like std::string::find
and substr
instead and surprisingly it turned out to be much faster
code and benchmark here
https://quick-bench.com/q/W_8UPCi7BG7isXYsVZAgTSIlCDo