Michael Schreckenbauer <[EMAIL PROTECTED]> writes: > Am Samstag, 29. November 2003 16:31 schrieb Ulrich Rhein: >> Jason Stubbs <[EMAIL PROTECTED]> writes: >> > On Saturday 29 November 2003 22:25, Ulrich Rhein wrote: >> >> Jason Stubbs <[EMAIL PROTECTED]> writes:
>> >> > The biggest improvement in performance will come by adding >> >> > -fomit-frame-pointer to your flags. >> >> That won't actually change anything but remove three instructions from >> >> some function calls. The resulting performance improvement is >> >> practically insignificant. >> > WTF? Have you tried it? >> Yes. > Shure? Compiling and timing one small program is no test. What about reading assembler diffs and counting CPU cycles? >> > Benchmarks give a 30% improvement across the board and >> > I must say there definately is a very noticable improvement to system >> > responsiveness. >> Entirely unrealistic. > Arguments? 30% is very optimistic, but I notice speed improvements too. The practical results of -fomit-frame-pointer is that gcc removes three instructions from some C funtions. There is no explanation why this should give such a radical improvement. >> > It may only remove three instructions from some function >> > calls, but it frees up a register or two allowing for better optimisation >> > in other ways. >> On x86, it's exactly one register (namely %ebp). I have tried it with >> gcc -S -O2 on a small project (~1.600 SLOC) of mine. In the functions in >> which %ebp is not used as frame pointer, it is not used at all. > So you tested it with one of your own programs and say we are telling shit? I didn't time in this program (which would be completely stupid anyway, because it is entirely I/O-bound), but I generated the assembler output (gcc's -S switch), once with -fomit-frame-pointer and once without. Then, I diffed the resulting files. I didn't find any occasion where gcc uses %ebp as anything but the frame pointer. The only reason I used my own project was that I could easily modify the Makefile. Another thing I measured was the latency of a function call on my athlon box. This is gcc -S of an empty function, compiled without -fomit-frame-pointer: ,---- | .p2align 4,,15 | .globl f | .type f,@function | f: | pushl %ebp | movl %esp, %ebp | popl %ebp | ret `---- Takes 15 cycles. And now with -fomit-frame-pointer: ,---- | .p2align 4,,15 | .globl f | .type f,@function | f: | ret `---- Takes 15 cycles as well. > I had my whole system compiled without this flag, then the only change > was adding it (and of course I recompiled my system). There was a > noticable performance boost. The desktop is much more responsive, not > only in my imagination. Would you mind to give some reproduceable situations? >> Could you point out some pieces of code where gcc does such an >> optimization? > No need for this. Just use google to get the answer. Eh? I asked for assembler diffs. Where can I find them on google? Gruß Uli -- "Or have we eaten on the insane root, that takes the reason prisoner?" -- MacBeth I, 3 -- [EMAIL PROTECTED] mailing list