Re: Java outperforms C++?



I'm spamming this newsgroup a lot, today...The topic attracted my attention
:-)

It's true that managed versus unmanaged code does not mean respectively slow
versus fast code.
But I can't imagine Java outperforming C++ on _every_ criterium. I need to
get that book, then. (I haven't read a word of it, yet).

As Joel Spolsky already mentioned in one of his articles, every code is
somewhat managed. Ever thought of the things "malloc" does before returning
a pointer to a segment?
Constantly allocating memory in unmanaged (C++) code results in poorer
performance every time you do a malloc, while managed code's performance
stays theoretically equal.

Ofcourse, if you are an experienced coder, you have created memory pool
classes and you're reusing memory blocks instead of freeing and allocing
again. The advantage of managed code is that you don't have to do the effort
again of building memory pools.

But again, I need to see it with my own eyes before I can start to believe
the story about Java outperforming C++. What compiler did they use? Did
they compare recursive C++ functions with iterative Java calls?

> What about C# and Java ?

Ok, first thing: I think you meant .NET and Java? Because there's no
performance difference when VB.NET or C#.NET.

The advantage that .NET has to Java is that the MS-developers have learned
from Java's mistakes and that the technology is from half a decade later. So
good comparison can't be made.
The biggest advantage .NET has, is the seamless cooperation with non-managed
code and COM objects and its remoting (SOAP) possibilities.

Ok, I got a bit off-topic. Any other views to this topic ?

Cheers,

Rob.

"Shreyas" <Shreyas@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0ECA3FF4-B957-4368-9437-BA3DE367EF01@xxxxxxxxxxxxxxxx
> What about C# and Java ?
>
> "benben" wrote:
>
>> I have taken C++'s speed for granted for years, so I was stunned by the
>> table of Cost of Common Operations between C++ and Java on page 601 of
>> Code
>> Complete 2nd Edition by Steve McConnell. It seems, as shown in the table,
>> that Java outperforms C++ in every criteria, if not merely matches the
>> latter.
>>
>> Is that I am reading the table the wrong way? or my previous assumption
>> has
>> been so wrong? or the author had the columns reversed?
>>
>> ben
>>
>>
>>


.



Relevant Pages

  • Re: OO compilers and efficiency
    ... >>> performance is due to Java implementations failing to optimise common OO ... > single good language designer. ... >> situations where a GC would outperform manual allocation though. ... >> Yes, that's true, but malloc and free are generally very efficient. ...
    (comp.programming)
  • Re: Error message about my user defined type
    ... Hanna-Barbera schrieb: ... It was an old cartoon show, ... Java is already fast. ... And in direct comparison to unmanaged Code ...
    (microsoft.public.vb.general.discussion)
  • C++ vs Java "new" (no flame war please!)
    ... Do not take anything about this, it is not a flame or troll, while I'm not ... memory overhead of malloc. ... but if you have 10 or 100 million objects, the malloc block overhead, ... Is there a way to create 10 to 100 million objects in Java with a reasonable ...
    (comp.lang.java)
  • Re: IBM article on Java performance
    ... mallocand memory allocation in Java doesn't even resemble each ... other so I can't really understand how optimizations possible for one ... of malloc() or free. ... in Java you have no such restriction. ...
    (comp.lang.java.advocacy)
  • Re: Good books for a complete beginner!
    ... And actually I believe Monique is a boys' name. ... Java and javascript are different. ... finally saw a malloc() for the first time instead of a new. ...
    (comp.lang.java.help)