[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200703061812.28478.dada1@cosmosbay.com>
Date: Tue, 6 Mar 2007 18:12:28 +0100
From: Eric Dumazet <dada1@...mosbay.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Davide Libenzi <davidel@...ilserver.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [patch v2] epoll use a single inode ...
On Tuesday 06 March 2007 17:28, H. Peter Anvin wrote:
> Eric Dumazet wrote:
> > For epoll, I suspect this is harmless : Programs dont allocate epolls fd
> > every milli second, but at startup only.
> >
> > For pipes/sockets, using a 64 bits would be problematic, because
> > sprintf() uses a divide for each digit. And a divide is slow. Ten
> > divides are *very* slow.
>
> That's true for *any* sprintf(), though. sprintf() converts all its
> arguments to 64 bits.
>
> However, this could be optimized. I think right now sprintf() uses a
> generic divide-by-base, but a divide by 8 and 16 can of course be
> handled with a shift, and divide by 10 can be replaced with a
> multiplication by 0x1999999999999999ULL on most architectures.
Or maybe just use reciprocal division, to keep the 35 bases available in
number()
Something like :
[PATCH] : Use reciprocal divides in sprintf()
pipe() syscalls spend a noticeable amount of time in sprintf() to format their
dentry name. One name may want to print 9 or 10 digits, using one divide per
digit.
Using reciprocal divides permits to change each divide by two multiplies, less
expensive on current CPUS.
Signed-off-by: Eric Dumazet <dada1@...mosbay.com>
View attachment "reciprocal_divide_in_sprintf.patch" of type "text/plain" (2864 bytes)
Powered by blists - more mailing lists