Re: [Patch] performance enhancement for simple_strtoul

2000-12-27 Thread Jamie Lokier
Pavel Machek wrote: > > [about strtoul] > > Perhaps I am mistaken but I'd expect it to be called what, ten times at > > boot time, and a couple of times when X loads the MTRRs? > > On second thought, ps -auxl maybe stresses simple_strtoul a little > bit. Not sure. Nah. proc_pid_lookup does its

Re: [Patch] performance enhancement for simple_strtoul

2000-12-22 Thread Pavel Machek
Hi! > > It seems gcc creates much better code with the variables set to register > > types. > > Curious. GCC should be generating the same code regardless; ah well. > > Is strtoul actually used in the kernel other than for the occasional > (rare) write to /proc/sys and parsing boot options? >

Re: [Patch] performance enhancement for simple_strtoul

2000-12-22 Thread Pavel Machek
Hi! > The following patch is a faster implementation of the simple_strtoul > function. This function differs from the original in that it reduces the > multiplies to shifts and logical operations wherever possible. My testing > shows that it adds around 100 bytes, but is about 6% faster on a K6-2

Re: [Patch] performance enhancement for simple_strtoul

2000-12-21 Thread Alan Cox
> On Wed, 20 Dec 2000, Steve Grubb wrote: > > > +while (isdigit(c)) { > > +result = (result*10) + (c & 0x0f); > > +c = *(++cp); > > +} > > x * 10 can be written as: > > (x << 2 + x) <

Re: [Patch] performance enhancement for simple_strtoul

2000-12-21 Thread Bernd Schmidt
On Thu, 21 Dec 2000, Matthias Andree wrote: > > x * 10 can be written as: > > (x << 2 + x) << 1 = (4x+x) * 2 > (x << 3) + (x << 1) = 8x + 2x Or as "x * 10". Which has the advantage of actually being readable, and letting the compiler optimize it into one of the other forms if that's profitable

Re: [Patch] performance enhancement for simple_strtoul

2000-12-21 Thread Matthias Andree
On Wed, 20 Dec 2000, Steve Grubb wrote: > +while (isdigit(c)) { > +result = (result*10) + (c & 0x0f); > +c = *(++cp); > +} x * 10 can be written as: (x << 2 + x) << 1 = (4x+x) * 2 (

Re: [Patch] performance enhancement for simple_strtoul

2000-12-20 Thread Jamie Lokier
Steve Grubb wrote: > It seems gcc creates much better code with the variables set to register > types. Curious. GCC should be generating the same code regardless; ah well. Is strtoul actually used in the kernel other than for the occasional (rare) write to /proc/sys and parsing boot options? >

Re: [Patch] performance enhancement for simple_strtoul

2000-12-20 Thread Steve Grubb
Hello, I continued experimenting with the Test Case and found a further speed improvement & I am re-submiting the patch. It is the same as the first one with the two local variables changed to register storage types. On a K6-2, I now see: Base 10 - 28% speedup Base 16 - 24% speedup Base 8 - 30%

Re: [Patch] performance enhancement for simple_strtoul

2000-12-20 Thread Steve Grubb
Hello, I thought about that. This would be my recommendation for glibc where the general public may be doing scientific applications. But this is the kernel and there are people that would reject my patch purely on the basis that it adds precious bytes to the kernel. But since the kernel is "cont

Re: [Patch] performance enhancement for simple_strtoul

2000-12-20 Thread Jeff Epler
On Wed, Dec 20, 2000 at 09:09:03AM -0500, Steve Grubb wrote: > Hello, > > The following patch is a faster implementation of the simple_strtoul > function. [snip] Why not preserve the existing code for bases other than 8, 10, and 16? Admittedly, the only other case that is likely to be used would

[Patch] performance enhancement for simple_strtoul

2000-12-20 Thread Steve Grubb
Hello, The following patch is a faster implementation of the simple_strtoul function. This function differs from the original in that it reduces the multiplies to shifts and logical operations wherever possible. My testing shows that it adds around 100 bytes, but is about 6% faster on a K6-2. (It