Struct method access speed

"Jérôme M. Berger" jeberger at free.fr
Wed Dec 26 15:06:04 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

bearophile wrote:
> A tiny benchmark of mine that's a reduced version of some real code (I hope my code doesn't contain bugs/silly inefficiencies). Four compilations (gdc, dmd, gcc, gcc aggressive):
> 
> gcc version 3.4.5 (mingw special) (gdc 0.24, using dmd 1.020)
> gdc -O3 -s -frelease -finline-functions -ffast-math -fomit-frame-pointer -funroll-loops -march=pentiumpro vec_test.d -o vec_test_gdc
> 
> dmd v1.024
> dmd -O -release -inline vec_test.d
> 
> 1) gcc version 3.4.2 (mingw-special)
> g++ -s -O3 vec_testCpp.cpp -o vec_testCpp
> 
> 2) gcc version 3.4.2 (mingw-special)
> g++ -O3 -s -finline-functions -ffast-math -fomit-frame-pointer -funroll-loops -march=pentiumpro vec_testCpp.cpp -o vec_testCpp
> 
> 
> Timings in seconds, N = 20_000, on Pentium 3:
> 
> dmd (D):
>   3.31
>   1.66
> 
> gdc (D):
>   8.92
>   1.39
> 
> gcc 1 (C++):
>   1.67
>   1.66
> 
> gcc 2 (C++):
>   1.36
>   1.36
> 
> The interesting results are for dmd: I think such two benchmarks have to run for the same time, but the experiment shows it's false for DMD.
> 
	The one that surprises me is gdc. For DMD, you actually fill the
vector twice in the first loop (once with zeroes, then a second time
with values) and it runs about twice as long as the second loop
which is normal. However, for gdc, I can't explain the large time
for the first loop...

		Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
|    mailto:jeberger at free.fr      | ICQ:    238062172            |
|    http://jeberger.free.fr/     | Jabber: jeberger at jabber.fr   |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHct5cd0kWM4JG3k8RAhdoAJ9zMhKsekC8dzOi2n+UtAgYhMvyswCfQfM9
Kwxd680CMZ37Rby6isc21tE=
=dHv4
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list