In case there's someone here who doesn't track the non-tech group, and is interested in these things, I made a small benchmark in order to test the Delphi x64 compiler.

In case there's someone here who doesn't track the non-tech group, and is interested in these things, I made a small benchmark in order to test the Delphi x64 compiler.

I did it mostly for fun, but I'd noticed that Delphi's x64 compiler did not use the extra registers in an effective manner. So I wanted to see just how it fared compared to a better optimizer.

For the test I used the Tiger hash function[1] as it is public domain, constructed to be fast on 64bit CPUs and it should take advantage of the higher register count. Using a hash function menas it's also easy to verify that the implementations compute the same thing.

The original C++ code was ported as closely as possible, while (hopefully) avoiding obviously stupid things.

The Delphi x64 compiler was beaten by Visual C++ 2012 by a factor of 2.3:

C++    480 MB/s
Delphi 205 MB/s
C#     140 MB/s (no "unsafe" code)

I re-ran the test on 32bit and Delphi fared a bit better:
C++    161 MB/s
Delphi  88 MB/s

More details, full source code and executables are available in the post I made.

[1]: http://www.cs.technion.ac.il/~biham/Reports/Tiger/
https://forums.embarcadero.com/message.jspa?messageID=599414#599414

Comments

  1. I wonder how the C++Builder compiler would do?

    ReplyDelete
  2. Lars Fosdal If I've understood correctly the x64 version of the C++ Builder is based on LLVM? If so it would indeed be very interesting. The code is small and has no dependencies, so it would be great if a C++ Builder user had a chance to take it for a spin.

    ReplyDelete
  3. Interesting how was this compiled?    With Delphi 2010 64 - about 93,02 MB/s

    ReplyDelete
  4. Krasimir Ivanov A raw number without information about your system doesn't tell much, unfortunately. The executables are included in the archives, so please try the VC++ version as well so we can have a reference.

    edit: and uhm, I tried to enable as much optimization as I could in Delphi, but there's not a whole lot of options for that...

    ReplyDelete
  5. Asbjørn Heid Included exe makes some 210,01 MB/s

    ReplyDelete
  6. Krasimir Ivanov Interesting. The included executable was compiled using XE3. You're certain optimizations and inlining are on? Getting only 93MB/s sounds completely aweful.

    ReplyDelete
  7. Sorry , this is 32 bit, of course.

    ReplyDelete
  8. Ah yes heh that would explain it. Should have thought about that earlier :-)

    ReplyDelete
  9. This thread is funny. How long time does it take to count from 0 to (maxint32+2) in python when compiling to C and then to 32 bit integer code with superoptimization?

    ReplyDelete

Post a Comment