speed: delphi vs. c/c++

can someone tell me how Delphi compares to C or C++ in speed? i'm not talking about compile speed.
thanks.


Comments

  • : 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.
  • : 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.
  • : 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.


  • : 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.


  • : : 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.
  • : : : 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




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories