Some FreeBSD performance Issues

Dan Nelson dnelson at allantgroup.com
Thu Nov 8 14:52:49 PST 2007


In the last episode (Nov 08), Randall Hyde said:
> It appears that character-at-a-time file I/O is *exceptionally* slow.
> Yes, I realize that when processing large files I really ought to be
> doing block/buffered I/O to get the best performance, but for certain
> library routines I've written it's been far more convenient to do
> character-at-a-time I/O rather than deal with all the buffering
> issues.  In the past, while slower, this character-at-a-time paradigm
> has provided reasonable, though not stellar, performance under
> Windows and Linux. However, with the port to FreeBSD I'm seeing a
> three-orders-of-magnitude performance loss.  Here's my little test
> program:
[...] 
> The "fileio.open" call is basically a bsd.open( "socket.h", bsd.O_RDONLY );
> API call.  The socket.h file is about 19K long (it's from the FreeBSD
> include file set). In particular, I would draw your attention to the first
> two tests that do character-at-a-time I/O. The difference in performance

What timings does 
"dd if=/usr/include/sys/socket.h of=/dev/null ibs=1 obs=64k" report? 
It takes about .4 sec on my non-idle dual pIII-900 system.  Try
truss'ing your program as it runs; maybe the program is doing some
extra syscalls you aren't aware of?

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-hackers mailing list