== Quote from Craig Black (craigbla...@cox.net)'s article
> > 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

OK, found and fixed the problem with GDC-4.4. My results are now:

g++-4.4 -O3 -march=native -ftree-vectorize
-------
Sorting with Array: 45861.599640
Sorting with pointers: 38417.632680
16.231372 percent faster

Sorting with Array: 46421.979120
Sorting with pointers: 38474.709840
17.119626 percent faster

Sorting with Array: 48622.885200
Sorting with pointers: 39593.385600
18.570473 percent faster
-------

gdc-4.4 -frelease -O3 -march=native -ftree-vectorize
-------
Sorting with Array.opIndex: 41454.052200
Sorting with pointers: 38331.517560
7.532520 percent faster

Sorting with Array.opIndex: 41109.852720
Sorting with pointers: 37836.883320
7.961521 percent faster

Sorting with Array.opIndex: 40587.349320
Sorting with pointers: 37390.488120
7.876497 percent faster
-------

dmd-2.050 -release -O -inline
-------
Sorting with Array.opIndex: 53561.598720
Sorting with pointers: 48348.626760
9.732667 percent faster

Sorting with Array.opIndex: 55861.658280
Sorting with pointers: 49909.880760
10.654495 percent faster

Sorting with Array.opIndex: 56887.660800
Sorting with pointers: 51470.453400
9.522640 percent faster
-------

I noticed that with dmd -inline needs to be explicitly set. Otherwise there 
appears to be nothing to suggest a wild difference
between using opIndex and pointers. :~)

Regards

Reply via email to