[cvs-nhc98] Hat library: Implemented new buffering scheme.
User olaf
olaf@sparud.net
Wed, 5 Jun 2002 17:04:14 +0200 (CEST)
olaf: Wed Jun 5 17:04:13 CEST 2002
Update of /usr/src/master/nhc/src/hat/lib
In directory hinken:/tmp/cvs-serv717/src/hat/lib
Modified Files:
Makefile hat.c
Log Message:
Hat library: Implemented new buffering scheme.
At Cambridge we noted, using strace, that fseek disturbs the file buffering of the operating system. It seems fseek always requires synchronisation. Hence it is important for efficiency to reduce the number of fseeks.
New trace nodes are not written directly to file but buffered. The advantage is that most updates concern parts in this buffer and hence can be done there instead of requiring an expensive fseek. The updates outside this buffer are still buffered separatly, so that basically only one fseek is required per update, not another one for going back to the end of file. Naturally the stack is also still used.
The sequential write buffer consists of 4 buffers a 20000 bytes. The exact number and size do not influence the performance on my machine very much. About 0.5% of the updates are outside the buffer. Runtime is reduced by about 45%.