www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - What's more efficient ???

↑ ↓ ← "jim p" <x y.com> writes:
I'm trying to find some information on the order of what operations execute
the fastest, eg. Transcendental  Functions, Square Root, Divide, multiply,
add/subtract, etc etc.



Also, for things like, is a for loop more efficient than a while loop?



I've been trying all day.

Can't seen to find anything.



Can anyone point me in the right direction.





Jim
Oct 05 2003
"Walter" <walter digitalmars.com> writes:
"jim p" <x y.com> wrote in message news:blpnb5$1hl2$1 digitaldaemon.com...
 I'm trying to find some information on the order of what operations

 the fastest, eg. Transcendental  Functions, Square Root, Divide, multiply,
 add/subtract, etc etc.

This usually depends on the CPU you're using. Check out the Intel CPU manuals for the various processors, they give the approximate times for each instruction. It also depends on the context, for that you'll need to do some benchmarking.
 Also, for things like, is a for loop more efficient than a while loop?

Neither. They generate the same code.
 I've been trying all day.
 Can't seen to find anything.
 Can anyone point me in the right direction.

Most of these kinds of questions are frequently very dependent on the compiler/CPU you're using. So the best way to answer them is to obj2asm the output of the compiler, or prepare a benchmark and time the results.
Oct 05 2003
↑ ↓ → "jim p" <x y.com> writes:
OK, Thanks Walter


"Walter" <walter digitalmars.com> wrote in message
news:blpogn$1j4t$1 digitaldaemon.com...
 "jim p" <x y.com> wrote in message news:blpnb5$1hl2$1 digitaldaemon.com...
 I'm trying to find some information on the order of what operations

 the fastest, eg. Transcendental  Functions, Square Root, Divide,


 add/subtract, etc etc.

This usually depends on the CPU you're using. Check out the Intel CPU manuals for the various processors, they give the approximate times for

 instruction. It also depends on the context, for that you'll need to do

 benchmarking.

 Also, for things like, is a for loop more efficient than a while loop?

Neither. They generate the same code.
 I've been trying all day.
 Can't seen to find anything.
 Can anyone point me in the right direction.

Most of these kinds of questions are frequently very dependent on the compiler/CPU you're using. So the best way to answer them is to obj2asm

 output of the compiler, or prepare a benchmark and time the results.

Oct 05 2003
"Alex Vinokur" <alexvn connect.to> writes:
"jim p" <x y.com> wrote in message news:blpnb5$1hl2$1 digitaldaemon.com...
 I'm trying to find some information on the order of what operations execute
 the fastest, eg. Transcendental  Functions, Square Root, Divide, multiply,
 add/subtract, etc etc.



 Also, for things like, is a for loop more efficient than a while loop?



 I've been trying all day.

 Can't seen to find anything.



 Can anyone point me in the right direction.

Try to use C/C++ Program Perfometer. The perfometer enables to get performance of C/C++ program and separated pieces of code for any metrics (for instance : clocks, uclocks, rusage-metrics, metrics defined by user etc.). The perfometer has been compiled with GNU g++ compiler. I also tried to compile it with Digital Mars C++ compiler. Unfortunately the compilation failed. ----------------------------------- ### Web page ### * http://alexvn.freeservers.com/s1/perfometer.html ----------------------------------- ### Download ### * http://sourceforge.net/projects/cpp-perfometer * http://alexvn.freeservers.com/s1/perfometer.zip (via http://alexvn.freeservers.com/s1/perfometer.html) ----------------------------------- ### Mailing List ### * Web Page : http://lists.sourceforge.net/lists/listinfo/cpp-perfometer-users * Posting : mailto:cpp-perfometer-users lists.sourceforge.net * Archives : http://sourceforge.net/mailarchive/forum.php?forum=cpp-perfometer-users ### Newsgroup ### * Gmane Group : news://news.gmane.org/gmane.comp.lang.c++.perfometer * Archives : http://news.gmane.org/gmane.comp.lang.c%2B%2B.perfometer Regards, ===================================== Alex Vinokur mailto:alexvn connect.to http://mathforum.org/library/view/10978.html =====================================
Oct 06 2003
↑ ↓ "jim p" <x y.com> writes:
That's just what I'm looking for.

You say you couldn't get it to compile under DM.
That's a pity.
What about Visual C++, have you tried it.

James


"Alex Vinokur" <alexvn connect.to> wrote in message
news:bls72l$256b$1 digitaldaemon.com...
 "jim p" <x y.com> wrote in message news:blpnb5$1hl2$1 digitaldaemon.com...
 I'm trying to find some information on the order of what operations


 the fastest, eg. Transcendental  Functions, Square Root, Divide,


 add/subtract, etc etc.



 Also, for things like, is a for loop more efficient than a while loop?



 I've been trying all day.

 Can't seen to find anything.



 Can anyone point me in the right direction.

Try to use C/C++ Program Perfometer. The perfometer enables to get performance of C/C++ program and separated

     (for instance : clocks, uclocks, rusage-metrics, metrics defined by

 The perfometer has been compiled with GNU g++ compiler.

 I also tried to compile it with Digital Mars C++ compiler.
 Unfortunately the compilation failed.

  -----------------------------------
     ### Web page ###
         * http://alexvn.freeservers.com/s1/perfometer.html


     -----------------------------------
     ### Download ###
         * http://sourceforge.net/projects/cpp-perfometer
         * http://alexvn.freeservers.com/s1/perfometer.zip
           (via http://alexvn.freeservers.com/s1/perfometer.html)


     -----------------------------------
     ### Mailing List ###
         * Web Page :

         * Posting  : mailto:cpp-perfometer-users lists.sourceforge.net
         * Archives :

     ### Newsgroup ###
         * Gmane Group :

         * Archives         :

 Regards,

    =====================================
    Alex Vinokur
      mailto:alexvn connect.to
      http://mathforum.org/library/view/10978.html
    =====================================

Oct 07 2003
↑ ↓ → "Alex Vinokur" <alexvn connect.to> writes:
"jim p" <x y.com> wrote in message news:blvo8s$21m4$1 digitaldaemon.com...
 That's just what I'm looking for.

 You say you couldn't get it to compile under DM.
 That's a pity.
 What about Visual C++, have you tried it.

I haven't try to do that. I am not working with Visual C++. You could try it. If you have any question you can ask them at : Mailing List : http://lists.sourceforge.net/lists/listinfo/cpp-perfometer-users Newsgroup : news://news.gmane.org/gmane.comp.lang.c++.perfometer Those are discussed C/C++ Program Perfometer issues. [snip] ===================================== Alex Vinokur mailto:alexvn connect.to http://mathforum.org/library/view/10978.html =====================================
Oct 07 2003