[Issue 5100] -O Degrades performance of loop statements

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 19 15:33:33 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=5100



--- Comment #7 from Iain Buclaw <ibuclaw at ubuntu.com> 2012-01-19 15:33:26 PST ---
Maybe not...

I actually get the reverse on my new laptop with 2.057,

$ dmd loop2.d
$ objdump loop2.o -d
push   %ebp
mov    %esp,%ebp
sub    $0x4,%esp
movl   $0x0,-0x4(%ebp)
cmpl   $0x7fffffff,-0x4(%ebp)
jge    1b <_Dmain+0x1b>
incl   -0x4(%ebp)
jmp    d <_Dmain+0xd>
xor    %eax,%eax
leave  
ret    

$ time ./loop2 
real    0m11.780s
user    0m11.769s
sys    0m0.004s

$ dmd loop2.d -O
$ objdump loop2.o -d
push   %ebp
mov    %esp,%ebp
xor    %eax,%eax
inc    %eax
cmp    $0x7fffffff,%eax
jb     5 <_Dmain+0x5>
pop    %ebp
xor    %eax,%eax
ret    

$ time ./loop2 
real    0m3.936s
user    0m3.924s
sys    0m0.008s

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list