看板 FB_hackers 關於我們 聯絡資訊
On Thu, 8 Nov 2007 16:52:38 -0600, Dan Nelson wrote: > 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? > on FreeBSD 6.2-RELEASE, it returns, dd if=/usr/include/sys/socket.h of=/dev/null ibs=1 obs=64k 18426+0 records in 0+1 records out 18426 bytes transferred in 0.070472 secs (261466 bytes/sec) -- Regards, /\_/\ "All dogs go to heaven." dinesh@alphaque.com (0 0) http://www.openmalaysiablog.com/ +==========================----oOO--(_)--OOo----==========================+ | for a in past present future; do | | for b in clients employers associates relatives neighbours pets; do | | echo "The opinions here in no way reflect the opinions of my $a $b." | | done; done | +=========================================================================+ _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"