Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Jun 2008 12:48:17 +0200
From:      Kris Kennaway <kris@FreeBSD.org>
To:        Kirk Strauser <kirk@strauser.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Poor read() performance, and I can't profile it
Message-ID:  <484915F1.10606@FreeBSD.org>
In-Reply-To: <4848AA65.9060600@strauser.com>
References:  <200806051508.29424.kirk@strauser.com>	<4848523E.2010604@FreeBSD.org> <200806051617.54400.kirk@strauser.com> <484867E3.3070705@FreeBSD.org> <4848757B.30408@strauser.com> <48489222.7020501@FreeBSD.org> <4848AA65.9060600@strauser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Kirk Strauser wrote:
> Kris Kennaway wrote:
> 
>> I don't understand what you meant by "It's also doing a lot of 
>> lseek()s to what is likely the current position anyway (example: seek 
>> to 0x00, read 16 bytes, seek to 0x10, etc.)." then.
> 
> I just meant that 16 was a smaller number than 4096 to use in an 
> example.  :-)
> 
> But anyway, it looks like I was wrong.  Each record in this test file is 
> 144 bytes long, but instead of reading 144 bytes, it's reading 4096 
> bytes then seeking backward 3952 (4096-144) bytes to the start of the 
> next record.  For instance:
> 
>  99823 dumprecspg CALL  lseek(0x3,0x1c8,SEEK_SET,0)
>  99823 dumprecspg CALL  read(0x3,0x8106000,0x1000)
>  99823 dumprecspg CALL  lseek(0x3,0x258,SEEK_SET,0)
>  99823 dumprecspg CALL  read(0x3,0x8106000,0x1000)
>  99823 dumprecspg CALL  lseek(0x3,0x2e8,SEEK_SET,0)
>  99823 dumprecspg CALL  read(0x3,0x8106000,0x1000)
>  99823 dumprecspg CALL  lseek(0x3,0x378,SEEK_SET,0)
>  99823 dumprecspg CALL  read(0x3,0x8106000,0x1000)
> Now, I know this is suboptimal.  My code is a patch on another, 
> longer-established project that I wasn't a part of, and I probably can't 
> do a lot about it without a pretty major rewrite.  Still, I can't 
> believe the same code is *so* much faster on Linux.  I'd also swear that 
> this is a regression and that it used to run much faster on the same 
> FreeBSD machine back when it was running 6.x, but I never bothered to 
> benchmark it then because it didn't seem to be an issue.

Can you confirm or provide a code sample?  What does strace show on Linux?

Kris



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?484915F1.10606>