Date: Mon, 12 Nov 2007 05:26:47 +1100 From: Peter Jeremy <peterjeremy@optushome.com.au> To: Randall Hyde <randyhyde@earthlink.net> Cc: freebsd-hackers@freebsd.org Subject: Re: Some FreeBSD performance Issues Message-ID: <20071111182647.GH82929@server.vk2pj.dyndns.org> In-Reply-To: <002701c8248b$9c2b8110$6302a8c0@pentiv> References: <000701c82253$b3a8c030$6302a8c0@pentiv> <20071108225238.GB22005@dan.emsphone.com> <4734061D.9000606@freebsd.org> <002701c8248b$9c2b8110$6302a8c0@pentiv>
next in thread | previous in thread | raw e-mail | index | archive | help
--xQmOcGOVkeO43v2v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 11, 2007 at 09:52:21AM -0800, Randall Hyde wrote: >why C's code was so much faster, I dug into the source code and discovered >that open/read/write/etc. use *buffered* I/O (which explains why "dd" >performs so well). open/read/write/etc. do _not_ do any buffering in userland. This is easily demonstrated using eg $ ktrace dd if=3D/dev/random of=3D/dev/null count=3D50 bs=3D1 The relevant part of the output is: 30532 dd CALL read(0x3,0x2820410c,0x1) 30532 dd GIO fd 3 read 1 byte ")" 30532 dd RET read 1 30532 dd CALL write(0x4,0x2820410c,0x1) 30532 dd GIO fd 4 wrote 1 byte ")" 30532 dd RET write 1 30532 dd CALL read(0x3,0x2820410c,0x1) 30532 dd GIO fd 3 read 1 byte "a" 30532 dd RET read 1 30532 dd CALL write(0x4,0x2820410c,0x1) 30532 dd GIO fd 4 wrote 1 byte "a" 30532 dd RET write 1 >At this point I'm not sure why FreeBSD's API call is so slow You have yet to provide any evidence of this. So far, you can only demonstrate it on your application - which strongly suggests it's a problem with your code, rather than FreeBSD. Have you check the ktrace output from your code or time(1)d it as suggested? --=20 Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an RFC2821-compliant MTA. --xQmOcGOVkeO43v2v Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFHN0ln/opHv/APuIcRAoAJAJ9GYJCfWp8zsZslEy97oskrh5wXnwCfe4Cy zAvkd65pdt9hpEc9SlnnS48= =uxuo -----END PGP SIGNATURE----- --xQmOcGOVkeO43v2v--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071111182647.GH82929>