by jacob navia <jacob@[EMAIL PROTECTED]
>
Apr 25, 2008 at 12:31 PM
Bartc wrote:
OK
1: I changed the code generator to emit the code as you want
2: I wrote this program:
typedef void (*fnptr)(void);
fnptr pfnptr;
fnptr *ppfnptr;
void n(void)
{
}
int main(void)
{
int i;
pfnptr=n;
ppfnptr = &pfnptr;
for (i=0; i<100000000; i++)
(*ppfnptr)();
}
Then I compiled using the new code generator. Elapsed time 1.558 seconds
Then I compiled using the old code generator. Elapsed time 1.502 seconds
The difference is not significative
Code generated by the old code generator:
[0000027] 8b1d00000000 mov 0x0,%ebx (_ppfnptr)
[0000033] ff141d00000000 call *0x0(,%ebx,1)
Code generated by the new code generator:
[0000027] 8b1d00000000 mov 0x0,%ebx (_ppfnptr)
[0000033] 8b1b mov (%ebx),%ebx
[0000035] ffd3 call *%ebx
I would like to improve the code generated, but I just do not understand
why you see such a difference.
Which CPU are you using?
Which OS?
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32