17 Oct 2007 cdfrey   » (Journeyer)

salimma,

    I ran into that performance problem too, with my simple newmail.cc mbox summary program (see update_mbox_cache()). You can work around it by replacing std::getline() with the normal .getline() member of the io class, and using a non-std::string buffer.

    It's still processing things line-by-line, which when compared to something like grep, is inefficient. Grep reads large blocks of the file, I think 16k or more at a time, and does its own very fast processing. But replacing std::string with a char buffer made the performance acceptable for me.

    I believe the main cause of performance issues with std::string stem from the way iostreams insert a character at a time, and when using std::string, it is not very smart when growing its buffer.

    I also find Boost regex to be rather slow at times, but perhaps I'm not using them correctly.

Latest blog entries     Older blog entries

New Advogato Features

FOAF updates: Trust rankings are now exported, making the data available to other users and websites. An external FOAF URI has been added, allowing users to link to an additional FOAF file.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!