c++ - What's more efficient ???
- jim p (8/8) Oct 05 2003 I'm trying to find some information on the order of what operations exec...
- Walter (10/17) Oct 05 2003 This usually depends on the CPU you're using. Check out the Intel CPU
- jim p (7/24) Oct 05 2003 OK, Thanks Walter
- Alex Vinokur (30/37) Oct 06 2003 [snip]
- jim p (15/64) Oct 07 2003 That's just what I'm looking for.
- Alex Vinokur (12/16) Oct 07 2003 I haven't try to do that. I am not working with Visual C++.
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
"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 operationsexecutethe 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
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...multiply,I'm trying to find some information on the order of what operationsexecutethe fastest, eg. Transcendental Functions, Square Root, Divide,eachadd/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 forinstruction. It also depends on the context, for that you'll need to dosomebenchmarking.theAlso, 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 obj2asmoutput of the compiler, or prepare a benchmark and time the results.
Oct 05 2003
"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.[snip] 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. ----------------------------------- * http://alexvn.freeservers.com/s1/perfometer.html ----------------------------------- * http://sourceforge.net/projects/cpp-perfometer * http://alexvn.freeservers.com/s1/perfometer.zip (via http://alexvn.freeservers.com/s1/perfometer.html) ----------------------------------- * 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 * 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
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...executeI'm trying to find some information on the order of what operationsmultiply,the fastest, eg. Transcendental Functions, Square Root, Divide,pieces of code for any metricsadd/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.[snip] 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 byuser 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. ----------------------------------- * http://alexvn.freeservers.com/s1/perfometer.html ----------------------------------- * http://sourceforge.net/projects/cpp-perfometer * http://alexvn.freeservers.com/s1/perfometer.zip (via http://alexvn.freeservers.com/s1/perfometer.html) ----------------------------------- * 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* Gmane Group :news://news.gmane.org/gmane.comp.lang.c++.perfometer* Archives :http://news.gmane.org/gmane.comp.lang.c%2B%2B.perfometerRegards, ===================================== Alex Vinokur mailto:alexvn connect.to http://mathforum.org/library/view/10978.html =====================================
Oct 07 2003
"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