Branch: Tag:

2010-11-01

2010-11-01 22:30:48 by Marcus Comstedt <marcus@mc.pp.se>

Improve performance of run_git_ex()

Instead of calling Pike.DefaultBackend() until p->status() says tha
the process has terminated, loop until both stdout and stderr have
been closed. This is better because otherwise we may be stuck
inside the backend for up to one second while the process is already
terminated. This change gives a considerable speedup on Solaris.

67:    mystderr->set_read_callback( lambda( mixed i, string data) {    gotstderr += data;    } ); -  while( !p->status() || p->status() == 1 ) -  Pike.DefaultBackend( 1.0 ); -  +  mystdout->set_close_callback( lambda () {    mystdout->set_read_callback(0); -  +  mystdout = 0; +  }); +  mystderr->set_close_callback( lambda () {    mystderr->set_read_callback(0); -  +  mystderr = 0; +  }); +  while( mystdout || mystderr ) +  Pike.DefaultBackend( 1.0 );    -  gotstdout += mystdout->read(); -  gotstderr += mystderr->read(); -  +     int exitcode = p->wait();       if (exitcode > max_exitcode) {