On Tuesday 06 March 2007 18:19, Linus Torvalds wrote: > On Tue, 6 Mar 2007, Eric Dumazet wrote: > > Something like : > > > > [PATCH] : Use reciprocal divides in sprintf() > > Try this on Core 2, and I suspect that you'll find that the hardware is > actually *faster* than doing the shift/test, function call and the > two multiplies. >
Where do you see a function call ? 448: 44 89 d0 mov %r10d,%eax 44b: 44 89 ea mov %r13d,%edx 44e: 48 0f af c1 imul %rcx,%rax 452: 48 c1 e8 20 shr $0x20,%rax 456: 0f af d0 imul %eax,%edx 459: 49 29 d2 sub %rdx,%r10 45c: 43 0f b6 14 16 movzbl (%r14,%r10,1),%edx 461: 41 89 c2 mov %eax,%r10d 464: 41 88 13 mov %dl,(%r11) 467: 49 ff c3 inc %r11 46a: 85 c0 test %eax,%eax 46c: 75 da jne 448 <number+0x138> > > Using reciprocal divides permits to change each divide by two multiplies, > > less expensive on current CPUS. > > Are you sure? I am going to test this, but at least on Opterons, the reciprocal divide I added into mm/slab.c gave me a nice speedup. I am going to bench some stupid loop : for (i = 0 ; i < 1000*1000 ; i++) { pipe(fds); close(fds[0]); close(fds[1]); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/