Recent

Author Topic: Delphi, Lazarus Pi Performance Benchmark  (Read 19623 times)

Anonymous

  • Guest
Delphi, Lazarus Pi Performance Benchmark
« on: June 20, 2004, 07:07:35 pm »
I found an interesting benchmark on http://www.tempest-sw.com/benchmark/.  The author wrote a small console application to compute Pi to any given number of digits.  He compiled this under a few different prorgramming languages.  Then he used a utilty called Timer to calculate how long it took to run different Pi computations.

Basically, I ported the Pi console application to Lazarus.  I compiled a Lazarus version of the application.  Similar to what the original author did, I used the Timer application to compare performance of the Delphi executable to the Lazarus one.

Versions used:
Delphi 7.0 Build 8.1 (7.1 update patch)
Lazarus 0.9.1b, FPC 1.9.3

Here are my results:

Digits, Delphi, Lazarus:
5, 20, 10
10, 10, 0
50, 10, 10
100, 11, 10
500, 60, 60
1000, 220, 241
5000, 5348, 5848
10000, 21741, 23705
15000, 48891, 53326
20000, 87325, 95127

When you compute Pi starting at around 1000 digits, you can see a small difference in the performance between the Delphi and Lazarus executables.  I bolded the numbers where you can see the difference.

I took the slower time and divided it by the faster time to get a percent difference.  For example, in the case of 20000 digits:  95127/87325=1.09.  

I interpret this to mean that the Delphi application runs about 9% faster computing Pi then the Lazarus version.

This was surprising to me.  For some of my Lazarus applications that were ported from Delphi, I had observed (subjectively) a significant increase in performance.

Anonymous

  • Guest
Delphi, Lazarus Pi Performance Benchmark
« Reply #1 on: June 20, 2004, 11:00:25 pm »
A computation like this is really checking performance of Delphi versus Free Pascal - not Delphi and Lazarus.

Now if you were testing how fast Delphi could create visual components... you'd compare Delphi versus FPC & Lazarus

IgD

  • Jr. Member
  • **
  • Posts: 73
    • http://www.igdsoftware.com
Delphi, Lazarus Pi Performance Benchmark
« Reply #2 on: June 21, 2004, 12:26:39 am »
Quite right.  Is there a forum for FPC?

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page

mikiwoz

  • Full Member
  • ***
  • Posts: 130
Delphi, Lazarus Pi Performance Benchmark
« Reply #4 on: November 08, 2004, 07:41:22 am »
Did you submit this to the FPC forum? If so - where? I cannot find this thread, but I am interested in  it.
TIA
Mike

mschnell

  • Full Member
  • ***
  • Posts: 131
    • http://www.lumino.de
Delphi, Lazarus Pi Performance Benchmark
« Reply #5 on: November 08, 2004, 08:49:47 am »
Quite obviously (and not astonishingly at all, regarding that other activities go on in the PC, too) the timer is not very accurate  for small timespans.

So you should enhance or modify your example.

E.g. you could repeat the calculation as often as necessary to last a minimum timespan and divede the time by the count in the end.


Moreover, it would be _very_ intersting to test  the floating point performance with another program. Here Delphi is  blamed to be worse than C++. How does Free Pascal perform ?

-Michael

Anonymous

  • Guest
Delphi, Lazarus Pi Performance Benchmark
« Reply #6 on: November 13, 2004, 06:24:44 am »
There are several aspects to performance...depending on what you wish to accomplish.  Awhile back, i devised a test that created objects in a TList for both FPC and Delphi guaging performance using QueryPerformanceCounter.  This done several months ago and i didn't keep the results, but if i remember correctly, Delphi was approx twice as fast as FPC in that regard.  Creating objects in a list object is a common programming task for me, and  unfortunately FPC underperformed significantly.

Angello

  • New Member
  • *
  • Posts: 12
Delphi, Lazarus Pi Performance Benchmark
« Reply #7 on: December 17, 2004, 05:56:26 pm »
Maybe it`s the price to be platform independent. Or delphi compiler uses more techniques to keep data in CPU registers, register function calls, instruction reordering for cpu pipelines. It can be also question of RTL asm optimizations.

Lightning

  • Sr. Member
  • ****
  • Posts: 422
Delphi, Lazarus Pi Performance Benchmark
« Reply #8 on: December 17, 2004, 10:54:20 pm »
The overall speed is important not this math test, of course you could make some optimizations depending on the target CPU.
The future must be... Fast and OpenSource so...
Think Open and Lightning Fast!

Anonymous

  • Guest
Delphi, Lazarus Pi Performance Benchmark
« Reply #9 on: December 18, 2004, 01:22:13 pm »
I have made a small test some time ago g++ vs FPC regarding classes. I created the same classes on the heap and freed it many times while calling their method(which were kinda linked..).
FPC was slightly slower than G++ but remember C++ has a static object model which is a bit faster. So I don't think fpc is slower than delphi in this deprartment(it might be but not that much)

I'm going to do some tests on win32 Borland Pascal(delphi) vs Free Pascal to see what gives ;-)

Anonymous

  • Guest
Delphi, Lazarus Pi Performance Benchmark
« Reply #10 on: August 16, 2005, 11:17:39 am »
I once made a compilation of the engine of my Othello (in Delphi written) playing program. The engine uses a lot of integer arithmetic and it is a lot optimised by hand (unrolling loops, program-generated code for speed improvements on the move generation etc.). The speed in Delphi is at least as fast as the best optimised C,C++ programs that are around and a lot faster that most of the others C,C++ programs that i know.
Unfortunatelly the speed in FPC was about 30-35% slower with almost all optimisations that i could found :(.  Too much for such a program if you want to stay at the top. I have hoped that FPC would be at least as fast as Delphi due to function inlining, specific processor optimisations and so on. The tests were done before 1 year so maybe the newer FPC versions are doing better.
I also had problems when i tried to implement the GUI of the program in Lazarus. The transparent images of the GUI were not transparent at all, but just drawn in a white square. Maybe this is already solved. These tests were also made before more than 1 year.

It seems to me that in Integer arithmetic Delphi did it and maybe still does it a lot better

Kostas

marmin

  • Jr. Member
  • **
  • Posts: 86
    • http://www.naton.org
Delphi, Lazarus Pi Performance Benchmark
« Reply #11 on: August 16, 2005, 01:45:28 pm »
Of course, one can not take conclusions on one test. my applications run much faster with FP.
Marmin^.Style
Location: Pointer Land!

Anonymous

  • Guest
Delphi, Lazarus Pi Performance Benchmark
« Reply #12 on: August 16, 2005, 02:59:42 pm »
It was never my intention to say that all kind of applications run faster in delphi than FPC. I was just speaking of course of my own tests.
What is much faster for you? What kind of application is yours?  I am really curious to know where FPC does better than Delphi in code generation. My Othello engine uses some MMX assembly for performing 64 bits operations, so i would like to test the new 64-bits version of FPC.

I also remember that it was impossble to debug using Lazarus. (I used Win2K). Anybody knows if this issue is solved in the newer versions? Btw. now i use WinXP professional. Any known issues with debugging in this plattform?

Regards
Kostas

marmin

  • Jr. Member
  • **
  • Posts: 86
    • http://www.naton.org
Delphi, Lazarus Pi Performance Benchmark
« Reply #13 on: August 17, 2005, 05:05:37 pm »
I started a 3D race game (i didn't finish it) and the game ran somewhat faster on Lazarus than on Delphi6. The game relied heavily on math- and Floating point calculations. (which are calculated each frame). I don't know why it ran faster. Could be several reasons.


Also, i found the FP compiler more 'pro': the game seemed to run more stable (but this could be fantasy :D), although compiling in Lazarus is somewhat slower. After porting to Lazarus I wouldn't return to Delphi no matter what :D  :D
--
 

About debuggingYes, there are some bugs in debugging. :)
Marmin^.Style
Location: Pointer Land!

 

TinyPortal © 2005-2018