[flang-dev] Performance of std::remove_if in F18 file I/O
Richard Barton via flang-dev
flang-dev at lists.llvm.org
Thu Apr 2 10:30:41 PDT 2020
During the code review on the patch to switch F18's file handling code from using C library to C++ library routines  we hit upon a case that seemed to show the C++ std::remove_if routine was much slower than the C routine on some platforms. The routine in question is RemoveCarriageReturns in lib/Parser/source.cpp  and existing findings are at . We are seeing quite different performance numbers across different platforms.
Peter Klausler made a little performance harness around the two proposed implementations and a third naïve implementation that we would expect to be the slowest (for reference rather than proposed for use in F18). I have attached this harness, with a few NFC modifications to this email.
Is anyone able to give this a run on their system and report their results? Please enable optimisation whilst compiling as this will match the F18 configuration we most care about. Please include the compiler and C & C++ standard library versions used as well as the architecture and platform. We've not tried this at all on Windows, so we'd be interested if anyone can provide that info.
The implementation using std::remove_if is preferred on LLVM-like style grounds so we would like to make this change. However, we don't want to significantly regress the performance of F18 file reading while we do that. We'd like to make the change but only if the new code is in the same performance ballpark as the existing code.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the flang-dev