Inlining Code Test

Craig Black craigblack2 at cox.net
Mon Dec 13 09:41:12 PST 2010


> Testing your C++ program (altered getCycle() for GCC)
>
> Times I get:
> -------
> Sorting with Array: 46869.159840
> Sorting with pointers: 38688.937320
> 17.453316 percent faster
>
> Sorting with Array: 46631.903760
> Sorting with pointers: 38520.609360
> 17.394302 percent faster
>
> Sorting with Array: 46674.330720
> Sorting with pointers: 38545.202520
> 17.416700 percent faster
> -------
>
>
> On a , I thought I might try an older version of GCC for the D program.
> Really surprisingly, I got:
>
> -------
> Sorting with Array.opIndex: 43075.059840
> Sorting with pointers: 40019.701920
> 7.093102 percent faster
>
> Sorting with Array.opIndex: 42940.085640
> Sorting with pointers: 39594.089040
> 7.792245 percent faster
>
> Sorting with Array.opIndex: 44389.127280
> Sorting with pointers: 41159.016960
> 7.276805 percent faster
> -------
>
> This will need some thinking through as to just what happened between 
> GDC-4.3 -> GDC-4.4 :~)
>
> Regards

Curious benches there.  Seems GCC isn't inlining (or other optimization) as 
well as Visual C++ here.  I'm getting a neglible ~2% difference.

-Craig 



More information about the Digitalmars-d mailing list