Delphi 64-bit sneak preview

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
rvida
Posts: 481
Joined: Thu Apr 16, 2009 12:00 pm
Location: Slovakia, EU

Delphi 64-bit sneak preview

Post by rvida »

Delphi 64bit is 3-4 years late, but finally it seems to be almost ready.

http://www.embarcadero.com/products/delphi/64-bit

Hope it is coming soon...
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Delphi 64-bit sneak preview

Post by Joost Buijs »

I hope the code generator will be optimizing better then the one from Free Pascal.
In 64 bit mode the output from Free Pascal is about two times slower then the output from a modern C++ compiler.
User avatar
Steve Maughan
Posts: 1221
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Delphi 64-bit sneak preview

Post by Steve Maughan »

Back in the late 90s Delphi was comparable to Visual C when it came to exe speed (at least for integers and strings). But C moved on, and Borland didn't invest anything in exe speed. This may have been a sensible decision since Delphi is "fast enough" (unless you're a bit twiddling chess programmer). I'd estimate a Delphi XE program will run at 20% to 40% slower than an equivalent C++ program.

The 64 bit version of Delphi will be interesting. The new owners of Delphi seem to be investing in the product. I'm also interested in the Mac, Linux and Android versions of Delphi. This could lead to interesting GUIs. For example Arena is written in Delphi.

Best regards,

Steve

BTW IMHO Delphi is still the best choice for general Windows 32 bit development - highly productive and solid EXEs.
tpetzke
Posts: 686
Joined: Thu Mar 03, 2011 4:57 pm
Location: Germany

Re: Delphi 64-bit sneak preview

Post by tpetzke »

The Free Pascal compiler isn't that bad. It is primarily designed for platform portability, write once - run everywhere. So the highly platform specific optimization cannot be build in.

For instance making your program multi threaded is very easy and clean compared with WINDOWS API calls it is just a bit slower as they use safe and general available methods for that.

My experience from porting my engine from free pascal to c++ was that the free pascal code is a bit slower than g++, but faster than Visual C++.

The difference between g++ and Visual C++ was bigger than the difference between g++ and Free Pascal.
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Delphi 64-bit sneak preview

Post by Joost Buijs »

tpetzke wrote: My experience from porting my engine from free pascal to c++ was that the free pascal code is a bit slower than g++, but faster than Visual C++.
Maybe you don't use bitboards or 64 bit because my experience is totally different. I keep a 1 to 1 copy of my C++ engine in Pascal and compared to MSVC++ the Free Pascal version runs twice as slow. And I really tried everything to make it run as fast as possible. Actually the latest MSVC compilers are very good, they even beat the Intel compiler most of the time. At least for my engine that's the case.
tpetzke
Posts: 686
Joined: Thu Mar 03, 2011 4:57 pm
Location: Germany

Re: Delphi 64-bit sneak preview

Post by tpetzke »

Hi,

in the pascal engine I use bitboards (the rotated ones) but it is currently a 32 bit version. For the C++ engine I went to magic bitbards and use a different move representation, so both versions can't be compared one to one.

However the g++ and MSVC compile from (almost) the same code.

The inline assembler in g++ has an awkward syntax style from a telco provider so I use builtin functions here instead of asm. In MSVC I use intel inline assembler. But this affects only popcount and bsf, everything else is the same.

It might be that I haven't optimized the hell out of MSCV, but comparing the release version of an MSVC build with a standard build of g++ favours g++.
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Delphi 64-bit sneak preview

Post by Joost Buijs »

tpetzke wrote:In MSVC I use intel inline assembler.
Hi,

Since you are using inline assembler with MSVC I assume that your C++ engine runs in 32 bit mode as well. MSVC does not support inline assembler in 64 bit mode. It will make a lot of difference speedwise when you compile your bitboard engine with a 64 bit compiler.
I don't have any recent experience with g++, in the past I found it very disappointing, of course things change over time.
User avatar
Bo Persson
Posts: 243
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: Delphi 64-bit sneak preview

Post by Bo Persson »

Joost Buijs wrote:
tpetzke wrote:In MSVC I use intel inline assembler.
Hi,

Since you are using inline assembler with MSVC I assume that your C++ engine runs in 32 bit mode as well. MSVC does not support inline assembler in 64 bit mode. It will make a lot of difference speedwise when you compile your bitboard engine with a 64 bit compiler.
I don't have any recent experience with g++, in the past I found it very disappointing, of course things change over time.
The popcount and BSF are available as compiler intrinsics in 64 bit mode, so there is no need for inline assembler.