!!! This patch also contains a critical bug fix and some code
cleanup, see below. !!!
The "Select tag/branch" dialog worked very slow on my
system when applied to local repositories. I've found that
one of the reason is that WinCvs does not suitably handle
very large textual outputs. (Another reason is a bug in cvsnt
that is provided with the WinCvs setup: The "-l" switch is
ignored for the "cvs log" command.)
With this patch, WinCvs is now able to handle very large
textual outputs much better than before. There is still room
for optimizations, however.
A complete list of changes follows.
ServeProtocol: Drastically minimized the number of
(expensive) calls to PeekNamedPipe by counting the
number of processed bytes and skipping the call if there still
is data in the pipe. (Several methods needed a new
parameter "gulong& rcount" to achieve this.)
CCvsRootConsole: Members m_cvsOut and m_cvsErr
(std::stringstream) have been replaced by m_cvsOutVec
and m_cvsErrVec (both std::vector<char>) and higher-level
access routines. Reason: stringstream (and strstream) work
horribly slow when appending data to large streams - on
overflow the data buffer is increased only by a constant
size, resulting in O(n^2) run time. With std::vector, the
internal buffer size is doubled on overflow, resulting in O(n)
amortized run time.
CCvsRootConsole: Replaced stringstream with istrstream.
Reason: The stream's initialization with a string only works
reasonably well with istrstream.
CAllHandlers: m_wireHandlers is now a "plain old" array of
size three. Using std::map for this trivial task hurt
cvs_process_give_time: Sleep(1) inserted for WIN32 to
avoid 100% CPU utilization.
struct _WireMessage: The formerly dynamically allocated
member "data" is now a static member of the struct. This
saves one malloc/free per message.
cvs_process_stack: Is now std::vector instead of
std::deque. This saves one malloc/free per message.
The following two are not related to performance but
included in this patch.
Bugfix (ItemListDlg.cpp, CTagParserConsole::Parse):
Stopping the retrieval of all tags sometimes crashed WinCvs
Code cleanup (ItemListDlg.*): Class CItemListConsole now
inherits from CCvsRootConsole, thus saving redundant
code (cvs_out, cvs_err, ...)
Log in to post a comment.