* Turn off synchronisation between C and C++ I/O functions. This

gives a huge speedup in operations that read or write from standard
  input/output.  (So libstdc++'s I/O isn't that bad, you just have to
  call std::ios::sync_with_stdio(false).)  For instance, `nix-store
  --register-substitutes' went from 1.4 seconds to 0.1 seconds on a
  certain input.  Another victory for Valgrind.
This commit is contained in:
Eelco Dolstra 2006-11-18 18:56:30 +00:00
parent 471749ca7e
commit 0541ddc7e3
2 changed files with 3 additions and 1 deletions

View file

@ -225,6 +225,8 @@ int main(int argc, char * * argv)
std::cerr.rdbuf()->pubsetbuf(buf, sizeof(buf)); std::cerr.rdbuf()->pubsetbuf(buf, sizeof(buf));
#endif #endif
std::ios::sync_with_stdio(false);
try { try {
try { try {
initAndRun(argc, argv); initAndRun(argc, argv);

View file

@ -632,7 +632,7 @@ static void opDump(Strings opFlags, Strings opArgs)
} }
/* A source that read restore intput to stdin. */ /* A source that reads restore input from stdin. */
struct StdinSource : RestoreSource struct StdinSource : RestoreSource
{ {
virtual void operator () (unsigned char * data, unsigned int len) virtual void operator () (unsigned char * data, unsigned int len)