Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
speed: delphi vs. c/c++ Posted by inhahe on 6 Jun 2004 at 4:40 PM
can someone tell me how Delphi compares to C or C++ in speed? i'm not talking about compile speed.
thanks.


Report
Re: speed: delphi vs. c/c++ Posted by Manning on 6 Jun 2004 at 6:00 PM
: can someone tell me how Delphi compares to C or C++ in speed? i'm not talking about compile speed.

Well you need to say what you are talking about.
Report
Re: speed: delphi vs. c/c++ Posted by zibadian on 6 Jun 2004 at 8:37 PM
: can someone tell me how Delphi compares to C or C++ in speed? i'm not talking about compile speed.
: thanks.
:
:
:
That also depends on which C(++) compiler you are using. The Borland C++ compiler generates code, which is similar in run-speed as Delphi. I don't know precisely how the ms C++-compiler compares to Delphi, but based on what I have observered it is also quite similar.

I would suggest that you write a simple benchmarking program in both Delphi and C++ to find out. A large bubble sort would be fine to give you an idea.
Report
Re: speed: delphi vs. c/c++ Posted by Masterijn on 7 Jun 2004 at 2:51 AM
: can someone tell me how Delphi compares to C or C++ in speed? i'm not talking about compile speed.
: thanks.
:
As a programmer who knows some assembly, I can assure you that the Delphi compiler generates very optimized code. Delphi's register calling and LongString stuff are I think better than in C++ (microsofts?). I think that in C++ if you take a long time and you are a advanced programmer you might write faster code, this is mainly because C++ supports inline functions and Delphi does not. (Programmers could make inline assembly functions in BP7 but they're gone). In a way the what makes code fast is mostly the kind of alogarithm that is used and not the compiler. Because of its fundamental optimalisations, Delphi programmers can write fast code in little time, this leaves a lot of time to think about the alogarithms. A good programmer (with knowlegde about alogarithm) doesn't worry about speed until the last moment. Than he'll know that only a small portion of the code need modification. The key is that early optimalisation can be a ball and chain, wich eventually leads to limited functionality or even a slow product.


Report
Re: speed: delphi vs. c/c++ Posted by erikkdr on 25 Aug 2004 at 10:14 AM
: can someone tell me how Delphi compares to C or C++ in speed? i'm not talking about compile speed.
: thanks.
:
:
:
Theres a way measuring time ellapsed to complete a procedure. Its an API call, and you need two variables. For example t1 and t2.

Sourcecode could be like this ..

procedure something
var t1, t2: Integer;
begin
t1 := Gettickcount;
// Do set the start before from where you want to control ellapsed time
t2 := Gettickcount;
//Set t2 after the procedure
showMessage(Inttostr(t2-t1)
end;


// Youll have an answer in milliseconds.


Report
Re: speed: delphi vs. c/c++ Posted by Koppis on 26 Aug 2004 at 12:55 AM
: : can someone tell me how Delphi compares to C or C++ in speed? i'm not talking about compile speed.
: : thanks.
: :
: :
: :
: Theres a way measuring time ellapsed to complete a procedure. Its an API call, and you need two variables. For example t1 and t2.
:
: Sourcecode could be like this ..
:
: procedure something
: var t1, t2: Integer;
: begin
: t1 := Gettickcount;
: // Do set the start before from where you want to control ellapsed time
: t2 := Gettickcount;
: //Set t2 after the procedure
: showMessage(Inttostr(t2-t1)
: end;
:
:
: // Youll have an answer in milliseconds.
:
:
:
And as far as I know, you should not worry much about whether you code by Object Pascal or C or C++. It is more important to optimize the loops in the code, than change programming language. Delphi's graphics are normally working with very nice speed, it shouldn't be the problem either. And ASM experts can optimize the loops in Delphi even more, but usually they are nearly perfect anyway.
Report
Re: speed: delphi vs. c/c++ Posted by Masterijn on 26 Aug 2004 at 2:39 AM
: : : can someone tell me how Delphi compares to C or C++ in speed? i'm not talking about compile speed.
: : : thanks.
: : :
: : :
: : :
: : Theres a way measuring time ellapsed to complete a procedure. Its an API call, and you need two variables. For example t1 and t2.
: :
: : Sourcecode could be like this ..
: :
: : procedure something
: : var t1, t2: Integer;
: : begin
: : t1 := Gettickcount;
: : // Do set the start before from where you want to control ellapsed time
: : t2 := Gettickcount;
: : //Set t2 after the procedure
: : showMessage(Inttostr(t2-t1)
: : end;
: :
: :
: : // Youll have an answer in milliseconds.
: :
: :
: :
: And as far as I know, you should not worry much about whether you code by Object Pascal or C or C++. It is more important to optimize the loops in the code, than change programming language. Delphi's graphics are normally working with very nice speed, it shouldn't be the problem either. And ASM experts can optimize the loops in Delphi even more, but usually they are nearly perfect anyway.
:
GetTickCount has a resolution of 1 msec, but a (standard) accuracy of +/- 50 msec. So in a way you can use it for long during performance checking. For short during stuff, one can use:
QueryPerformanceCounter and QueryPerformanceFrequency







 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.