- "Is C++ fast?" - 25 Updates
Jux und Tollerei <Jux.und.Tollerei@gmail.com>: Jan 24 09:21AM +0100 C++ is about as fast as Java with a decent JIT-compiler. |
Stuart Redmann <DerTopper@web.de>: Jan 24 10:35AM +0100 > Totally agree, C#/Java make simple what in c++ takes more work. > Best regards, > Daniel I wouldn't say "takes more work" but rather is easier to get wrong or inefficient. As a general guideline, one should use plain pointers in function calls, if the called function does not need to know about ownership of the pointer. That adds zero overhead to the calling code, but requires you to know when to use smart pointers as parameters and when to use plain pointers. IOW, you can code just as efficiently and effortlessly as in Java but you have to know what you are doing. Most of the time you would not even use pointers as parameters but rather const references. If I had to mimic const-reference-parameters in Java, I would have to write tons of code. Java code is usually littered with checks that parameters are not null. These checks are usually not needed in C++, so "proper" Java code is inherently slower than C++ code, even if Java is executed as native code. Regards, Stuart |
"Öö Tiib" <ootiib@hot.ee>: Jan 24 01:37AM -0800 On Thursday, 24 January 2019 10:21:48 UTC+2, Jux und Tollerei wrote: > C++ is about as fast as Java with a decent JIT-compiler. Controversial topic. 1) Pure C++ and Java in expert hands and compiled and ran with most decent stuff there is then C++ runs algorithms about twice faster, C++ takes about twice less power and the memory usage is about 6 times smaller. Python has twice smaller memory usage than Java but is also way slower and more energy consuming than Java. 2) Experts are limited and expensive resource. Most of code is written by mediocres or worse. If to compare languages in hands of beginners then picture is reversed and C++ is usually doing worst. It is harder to damage efficiency with Python. 3) We do not have pure things in actual reality. Most working systems are hybrids where custom code written by less experienced programmers forwards most heavy lifting to C or C++ libraries and modules (that are written by more experienced programmers). There the efficiency differences of 1) do not manifest but noob factor of 2) takes its toll. |
Jux und Tollerei <Jux.und.Tollerei@gmail.com>: Jan 24 10:47AM +0100 > usage is about 6 times smaller. Python has twice smaller memory > usage than Java but is also way slower and more energy > consuming than Java. That's your *opinion*, which is affected by your taste. Java can be even faster than C++ in most cases because of its dynamic compilation. |
leigh.v.johnston@googlemail.com: Jan 24 02:09AM -0800 On Thursday, January 24, 2019 at 9:47:19 AM UTC, Jux und Tollerei wrote: > That's your *opinion*, which is affected by your taste. > Java can be even faster than C++ in most cases because of its > dynamic compilation. False. Also, most JVMs are written in C++. /Leigh |
David Brown <david.brown@hesbynett.no>: Jan 24 11:15AM +0100 On 24/01/2019 10:47, Jux und Tollerei wrote: > That's your *opinion*, which is affected by your taste. > Java can be even faster than C++ in most cases because of its > dynamic compilation. No, it cannot. There /are/ situations where dynamic compilation can result in faster code than static compilation. I've seen examples of PyPy being faster than equivalent C code when using generic algorithms - JIT compilation can make specialised versions of functions for each type used, while the C code would use generic functions like "memcpy" and indirect comparison functions. But with C++, the equivalent code would be template based and these specialisations would be sorted out at compile time. This will beat JIT every time. The only other way I know of for JIT to beat static compilation, other than forgetting to enable optimisation, would be if the static compilation were done for a very generic member of the processor family while the JIT tuned for specific features (like SIMD instructions). However, I would not expect Java with JIT to come close to tuned C++ code compiled for the specific target features. And compilers like gcc let you (relatively) easily make multiple copies of critical functions, picking the best one at run-time for the processor you happen to use. Of course, in any given project there are many other things to take into account when talking about speed. Speed of development, time to market, speed of code for a given development budget, etc. You can often get a great deal more speed for your money using Python and PyPy (JIT) than Java or C++ - there is no single right answer to "fastest programming language". But the idea that dynamic compilation is faster than static compilation is, for the most part, wrong. |
Bonita Montero <Bonita.Montero@gmail.com>: Jan 24 11:20AM +0100 >> Java can be even faster than C++ in most cases because of its >> dynamic compilation. > False. Also, most JVMs are written in C++. You can write a compiler in a scripting-language which ist significantly slower than the compiled code. |
Bonita Montero <Bonita.Montero@gmail.com>: Jan 24 11:22AM +0100 No, JITs are faster in most cases. |
Jux und Tollerei <Jux.und.Tollerei@gmail.com>: Jan 24 12:08PM +0100 > Shootoutgames has done so and shown Java to be > slower by a factor of two. That depends on the skill of the Java-programmer. |
"Öö Tiib" <ootiib@hot.ee>: Jan 24 03:11AM -0800 On Thursday, 24 January 2019 11:47:19 UTC+2, Jux und Tollerei wrote: > > usage than Java but is also way slower and more energy > > consuming than Java. > That's your *opinion*, which is affected by your taste. No. It is opinion of researchers. https://sites.google.com/view/energy-efficiency-languages/results?authuser=0 > Java can be even faster than C++ in most cases because of its > dynamic compilation. I agreed (but you snipped) that it is so in idiots hands. Perhaps your personal experience is talking. |
"Öö Tiib" <ootiib@hot.ee>: Jan 24 03:19AM -0800 On Thursday, 24 January 2019 13:08:49 UTC+2, Jux und Tollerei wrote: > > Shootoutgames has done so and shown Java to be > > slower by a factor of two. > That depends on the skill of the Java-programmer. Why only the weak Java programmers enter competitions so best is twice worse than best C++ competitor? |
Jux und Tollerei <Jux.und.Tollerei@gmail.com>: Jan 24 12:20PM +0100 > No. It is opinion of researchers. > https://sites.google.com/... Yes, the *opinion*, not the fact! |
Jux und Tollerei <Jux.und.Tollerei@gmail.com>: Jan 24 12:21PM +0100 >> That depends on the skill of the Java-programmer. > Why only the weak Java programmers enter competitions so best > is twice worse than best C++ competitor? I don't know, but skilled programmers get more performance out of a JVM than with native languages in most cases. |
scott@slp53.sl.home (Scott Lurndal): Jan 24 01:41PM >> is twice worse than best C++ competitor? >I don't know, but skilled programmers get more performance out of >a JVM than with native languages in most cases. Proof by assertion isn't sufficient. Show your work - provide citations for the studies that prove your assertion. |
"Öö Tiib" <ootiib@hot.ee>: Jan 24 05:53AM -0800 On Thursday, 24 January 2019 13:21:42 UTC+2, Jux und Tollerei wrote: > > is twice worse than best C++ competitor? > I don't know, but skilled programmers get more performance out of > a JVM than with native languages in most cases. Why you reiterate your bald unsubstantiated assertions? Canät give any cites? Are you religious Java fundamentalist? Those indeed can't win any competitions because they are dumb. Only thing that is sure that they get more performance out of JVM than from anything else. They worship it. Sad, but somehow makes me laugh. :D https://sites.google.com/view/energy-efficiency-languages/results?authuser=0 |
"Öö Tiib" <ootiib@hot.ee>: Jan 24 05:58AM -0800 On Thursday, 24 January 2019 13:20:34 UTC+2, Jux und Tollerei wrote: > > No. It is opinion of researchers. > > https://sites.google.com/... > Yes, the *opinion*, not the fact! Look it again these were tables of facts https://sites.google.com/view/energy-efficiency-languages/results?authuser=0 |
Jux und Tollerei <Jux.und.Tollerei@gmail.com>: Jan 24 03:51PM +0100 > JVM than from anything else. They worship it. Sad, but somehow > makes me laugh. :D > https://sites.google.com/view/energy-efficiency-languages/results?authuser=0 Consider this analogy: when you spend more energy in something, you are faster. |
Jux und Tollerei <Jux.und.Tollerei@gmail.com>: Jan 24 03:52PM +0100 >> Yes, the *opinion*, not the fact! > Look it again these were tables of facts > https://sites.google.com/view/energy-efficiency-languages/results?authuser=0 This is about energy-efficiency, not speed. |
Christian Gollwitzer <auriocus@gmx.de>: Jan 24 03:59PM +0100 Am 24.01.19 um 14:53 schrieb Öö Tiib: >> I don't know, but skilled programmers get more performance out of >> a JVM than with native languages in most cases. > Why you reiterate your bald unsubstantiated assertions? Because he is an obvious troll. Even the nickname ("Jux und Tollerei" = German for "Just for fun") tells this. Christian |
"Öö Tiib" <ootiib@hot.ee>: Jan 24 07:03AM -0800 On Thursday, 24 January 2019 16:51:43 UTC+2, Jux und Tollerei wrote: > > https://sites.google.com/view/energy-efficiency-languages/results?authuser=0 > Consider this analogy: when you spend more energy in something, > you are faster. When you spend more energy on something then you are less efficient. Look at those tables again, (and cry, :D) time was also given there. |
"Öö Tiib" <ootiib@hot.ee>: Jan 24 07:07AM -0800 On Thursday, 24 January 2019 16:52:44 UTC+2, Jux und Tollerei wrote: > > Look it again these were tables of facts > > https://sites.google.com/view/energy-efficiency-languages/results?authuser=0 > This is about energy-efficiency, not speed. Look again, all of speed, energy and memory usage was measured. |
"Öö Tiib" <ootiib@hot.ee>: Jan 24 07:10AM -0800 On Thursday, 24 January 2019 17:00:01 UTC+2, Christian Gollwitzer wrote: > > Why you reiterate your bald unsubstantiated assertions? > Because he is an obvious troll. Even the nickname ("Jux und Tollerei" = > German for "Just for fun") tells this. I enjoy his trolling. At least it is more on topic than Rick's sad story of fruitless messenger of Creator. |
Jux und Tollerei <Jux.und.Tollerei@gmail.com>: Jan 24 04:22PM +0100 >> you are faster. > When you spend more energy on something then you are less efficient. > Look at those tables again, (and cry, :D) time was also given there. Speed rules over efficiency. |
Jux und Tollerei <Jux.und.Tollerei@gmail.com>: Jan 24 04:23PM +0100 >>> https://sites.google.com/view/energy-efficiency-languages/results?authuser=0 >> This is about energy-efficiency, not speed. > Look again, all of speed, energy and memory usage was measured. Then they obviously made a major mistake. It is a physical principe, that when you make more effort, i.e. get less efficiency, you get a higher performance. |
Manfred <noname@add.invalid>: Jan 24 04:28PM +0100 On 1/24/2019 4:03 PM, Öö Tiib wrote: >> you are faster. > When you spend more energy on something then you are less efficient. > Look at those tables again, (and cry, :D) time was also given there. Or: in IT (i.e. Information Technology in case he doesn't recall), more energy typically means more CPU cycles, i.e. slower computing. (More sobbing echoes..) |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment