> Programming Languages > C++
Various Topics Home | Disclaimer | Report Adult Posts

Various Topics on C++



C++ - "Java's performance far better that optimized C++" in Programming Languages


Old 06-19-2004   #101
..lent.. ..homir..
 
Default Re: Java's performance far better that optimized C++

> Fanaticism is not a good advisor. :-) Why faster in Java? Can you give a
> concrete example?


In java, we have a rich abudance of neat cl***es. In VC++ (I have no
experiance with other IDEs, but MS's studio is an acknowledged leader) we
have a huge number of types, cl***es. Do***entation is huge and of ugly
quality, it is not possible to understand how working a method without
trying it. Two my collegues (newbies but MFC fans) was trying to use sockets
to p*** a file, it has taken them a whole week to choose socket cl*** and
make it working. I should have given them a link to java sockets tutorial
just for them to understand what is a socket. MSDN (these 3 gigs of stuff)
contains huge number of incomplete and contravertial manuals.
IDEs. I preferer an IDE that is aware of my code structure. VC is a notepad.
It cannot even find the definition of a variable (shows you a list of
candidates). Intellij checks your code when you're typing.

Compiler. C++ has extremely slow compiler (it produces tremendous amounts of
info and processes them). The compiler is extremely stupid. You can create a
cl*** (in a file) which is compilable. The cl*** stops compiling once
attached to a project. Compiler shows a stupid message like "something
expected". Finally, you realize you have forgotten to put a closing parensis
in some another file of the project. I favor any lang withour includes.
Often messages like unresolved method appear and compiler cannot point to
the line.

The need for .h files bizzare, interface must be typed twice. Complicates
modifications.

Exceptions. not handeled exception shows you a reasonable error message and
stack trace. It is allows to locate an error without using an IDE debugger!

GC. Hard to debug problem, no memory leaks are guaranteed.

Exceptions+GC+sandbox is time saver in application programming and paramount
in erterprise programming. Therefore, MS has to invent C#.


If I need to program for performance, I'll use Delphi for win; it beats VC++
by all the params (it is java in spirit but concept is native compilation +
no GC). The resulting code is faster. In last week I have won a bet with my
VC++ fan collegue (it was his idea) implementing bubble sort algorithm. In
addition, woring directory is tiny, tens of kilobytes and some files vs.
tens megabytes and some directories of files per project.



I really like java but i'm not a fan. I'm very critial to it. I see some
inconsistencies in Java adopted methodologies and struggle with really blind
java programmers who think that java techniques are absolutely correct ones
and any general programming considerations must fit java conventions. For
example, many of the java "beleivers" are convinced that "set" container
must not have get(key) forcing others to use map (object, object) just
because java collections do not enable it.

I think I can be critical cos know many languages. The fact is that the most
diguisting experiences I've got from VC++ and Basic. May be it is because
MS is most-developer-hostile-environment-award-winning company? Their SQL
server seems developer-friendly though.




> (for example you can't replace HTML
> neither with Java or C++, another example is PHP), nor in terms of a
> system and so on.

HTML is not a programming language, it is a file format for visual info
representaion like JPEG. You can use JSP instead of PHP. JSPs, as
general-purpose lang, can benefit from getting natural direct access to
objects of enterprise Java application. IMO, general-purpose means you can
write anything on them (media player, DB engine, sockets, graphical
application and text ptocessor). OS requires memory direct access/interrupt
support; these are not general-purpose features. Whether using OO or another
paradigm it does not matter.


> The programming world is multi paradigm and multilingual. When you
> understand this, it will be good for you.

I do not agree. For any purpose there should be only one tool (language). I
know many langs from different groups (general-purpose, asms, SQL, scripts,
hardware description langs), SystemC will be the next step. Langs in one
group are competitors. However, we cannot support/learn all of them, in each
group must exist only one. As I'm idialist, I want these to be simple yet
powerfuls ones. I don't like when far from the best langs (C++, english)
suppress others. The fact that english is overly complicated is not just my
feeling, it is info from lingusits on EU, it is very irregular. I have the
same considerations about C++ (the compiler approves).
All C++ programmers are sure that C++ is faster than Delphi (I have shown on
bubble sort example it is false). I see the troubles that VC++ collegues
experience, like converting int to str or loading/showing icons dynamically.
I show code can be written tens of times faster in Delphi and it executes
faster but they go on writing VC++. It is not fanatism; these are
misconceptions + pragmatism. My collegue who lost the bet still tells it is
not possible that Delphi compiler produces fater code. I do will not insist
that it is faster in general but any peformance differences < 20% are not
observable anyway. In addition, they merely ignore any not popular
opportunities. It is the client who knows that C++ rules the wolrd, he has
huge number of C++ code lines and mandates the tool. Do you choose the tool
yourself?

When considering languages, there is one important parameter which is more
important than language complexity (learning curve), development effort and
execution performance all together. It is the number of "language carriers".
Looking into the future, this means that number of language carriers will
rise with no chances for alternatives. This makes me unhappy, because as
idialist, I know that in presence of a more effective tool it makes sense to
go on using an adopeted one only in short-term perspective. Adoptation of a
new (more efficient) technology gives considerable benefits in the
long-term.


But all we live today and have habits. All I have written here is useless,
because nobody agree/cares. Further discussion is really useless.



Best Regards


 
Old 06-20-2004   #102
..ann.. ..an..
 
Default Re: Java's performance far better that optimized C++

valentin tihomirov wrote:

>



Knowing that such discussions never end, here is my answer:


> In java, we have a rich abudance of neat cl***es. In VC++ (I have no
> experiance with other IDEs, but MS's studio is an acknowledged leader) we
> have a huge number of types, cl***es. Do***entation is huge and of ugly
> quality, it is not possible to understand how working a method without
> trying it. Two my collegues (newbies but MFC fans) was trying to use sockets
> to p*** a file, it has taken them a whole week to choose socket cl*** and
> make it working. I should have given them a link to java sockets tutorial
> just for them to understand what is a socket. MSDN (these 3 gigs of stuff)
> contains huge number of incomplete and contravertial manuals.
> IDEs. I preferer an IDE that is aware of my code structure. VC is a notepad.
> It cannot even find the definition of a variable (shows you a list of
> candidates). Intellij checks your code when you're typing.



MFC etc. are system extensions and not part of the language
specification. VC++ is just a compiler of many.

However regarding the above, I know .NET programming and not MFC and in
..NET it is very easy to create a web service for example and VC++ 7.x
include intellisense.

Again it has nothing to do with C++, and if the Java framework was open
to other languages, we would be able to use it with C++.




>
> Compiler. C++ has extremely slow compiler (it produces tremendous amounts of
> info and processes them). The compiler is extremely stupid. You can create a
> cl*** (in a file) which is compilable. The cl*** stops compiling once
> attached to a project. Compiler shows a stupid message like "something
> expected". Finally, you realize you have forgotten to put a closing parensis
> in some another file of the project. I favor any lang withour includes.



And using what else instead?


> Often messages like unresolved method appear and compiler cannot point to
> the line.


?


> The need for .h files bizzare, interface must be typed twice. Complicates
> modifications.



No it eases modifications. ***uming that you place declarations inside
..h files only, you can change the definitions and not need to recompile
the whole project, but only the modified files as far as the
"signatures" remain the same.




>
> Exceptions. not handeled exception shows you a reasonable error message and
> stack trace. It is allows to locate an error without using an IDE debugger!



It depends on the platform, the same things happen with my compiler. A
stack trace is provided.



>
> GC. Hard to debug problem, no memory leaks are guaranteed.



If you program using the "resource acquisition is initialization
technique", the result is bullet proof code with optimum space and time
efficiency.

[Reference: "The C++ Programming Language" 3rd Edition or Special
Edition, pages 365-367]


However I have GC in my .NET programming.



From "The C++ Programming Language" 3rd Edition or Special Edition:


"C.9.1 Automatic Garbage Collection

When this regular approach isn’t sufficient, the programmer might use a
memory manager that finds unreferenced objects and reclaims their memory
in which to store new objects. This is usually called automatic garbage
collection, or simply garbage collection. Naturally, such a memory
manager is called a garbage collector.

The fundamental idea of garbage collection is that an object that is no
longer referred to in a program will not be accessed again, so its
memory can be safely reused for some new object. For example:

void f()
{
int* p = new int;
p = 0;
char* q = new char;
}

Here, the ***ignment p=0 makes the int unreferenced so that its memory
can be used for some other new object. Thus, the char might be allocated
in the same memory as the int so that q holds the value that p
originally had.

The standard does not require that an implementation supply a garbage
collector, but garbage collectors are increasingly used for C++ in areas
where their costs compare favorably to those of manual management of
free store. When comparing costs, consider the run time, memory usage,
reliability, portability, monetary cost of programming, monetary cost of
a garbage collector, and predictability of performance."










>
> Exceptions+GC+sandbox is time saver in application programming and paramount
> in erterprise programming. Therefore, MS has to invent C#.
>
>
> If I need to program for performance, I'll use Delphi for win; it beats VC++
> by all the params (it is java in spirit but concept is native compilation +
> no GC). The resulting code is faster. In last week I have won a bet with my
> VC++ fan collegue (it was his idea) implementing bubble sort algorithm. In
> addition, woring directory is tiny, tens of kilobytes and some files vs.
> tens megabytes and some directories of files per project.



:-) Ok if you like Delphi better, use Delphi then. However I think VC++
produces more optimised code and there are other C++ compilers too like
GCC ports for Windows (MINGW, DJGPP), etc.


>>The programming world is multi paradigm and multilingual. When you
>>understand this, it will be good for you.

>
> I do not agree. For any purpose there should be only one tool (language).



And punish anyone else who dares to create a language? :-)



> I
> know many langs from different groups (general-purpose, asms, SQL, scripts,
> hardware description langs), SystemC will be the next step. Langs in one
> group are competitors. However, we cannot support/learn all of them, in each
> group must exist only one. As I'm idialist, I want these to be simple yet
> powerfuls ones. I don't like when far from the best langs (C++, english)
> suppress others. The fact that english is overly complicated is not just my
> feeling, it is info from lingusits on EU, it is very irregular. I have the
> same considerations about C++ (the compiler approves).




So you can talk the language that you like and program in the language
you like, while letting anyone else use whatever he likes too.



> All C++ programmers are sure that C++ is faster than Delphi (I have shown on
> bubble sort example it is false). I see the troubles that VC++ collegues
> experience, like converting int to str or loading/showing icons dynamically.
> I show code can be written tens of times faster in Delphi and it executes
> faster but they go on writing VC++. It is not fanatism; these are
> misconceptions + pragmatism. My collegue who lost the bet still tells it is
> not possible that Delphi compiler produces fater code. I do will not insist
> that it is faster in general but any peformance differences < 20% are not
> observable anyway. In addition, they merely ignore any not popular
> opportunities. It is the client who knows that C++ rules the wolrd, he has
> huge number of C++ code lines and mandates the tool. Do you choose the tool
> yourself?



This is quite useless discussions since all those compilers including
Java ones are all written in C++...




> When considering languages, there is one important parameter which is more
> important than language complexity (learning curve), development effort and
> execution performance all together. It is the number of "language carriers".
> Looking into the future, this means that number of language carriers will
> rise with no chances for alternatives. This makes me unhappy, because as
> idialist, I know that in presence of a more effective tool it makes sense to
> go on using an adopeted one only in short-term perspective. Adoptation of a
> new (more efficient) technology gives considerable benefits in the
> long-term.
>
>
> But all we live today and have habits. All I have written here is useless,
> because nobody agree/cares. Further discussion is really useless.



Well it is, since everyone will stick whatever he likes more, as far as
it produces results, and I can see nothing bad in this. For example if
one wants to make some simple number addition programs I see no reason
why it would be bad to use qbasic.






Regards,

Ioannis Vranos
 
Old 06-20-2004   #103
..v.. ..rm..
 
Default Re: Java's performance far better that optimized C++

On Sat, 19 Jun 2004 16:49:48 GMT in comp.lang.c++, "Victor Bazarov"
<v.Abazarov@comAcast.net> wrote,
>"Julie" <julie@nospam.com> wrote...
>> [...]
>> I now realize that. However, not because you said so, [...]

>
>You break my heart!


How do you think Marshall Cline must feel?
"inappropriate and immature"

 
Old 06-20-2004   #104
..v.. ..rm..
 
Default Re: Troll Alert: Java's performance far better that optimized C++

On Fri, 18 Jun 2004 08:47:40 -0700 in comp.lang.c++, "E. Robert Tisdale"
<E.Robert.Tisdale@jpl.nasa.gov> wrote,
>Congratulations on your fantastic troll.
>54 responses and counting.


But you really should not give full score for a second-hand troll!

 
Old 06-20-2004   #105
..lent.. ..homir..
 
Default Re: Java's performance far better that optimized C++

> Again it has nothing to do with C++, and if the Java framework was open
> to other languages, we would be able to use it with C++.

I've heard that Phyton has a compiler into java bytecodes. But I don''t
understand why to use C++ on Java platform. If we have a good language why
to use something else?
IMHO, manageged VC++ is a nonsence. It neglects all the concept of C++
(native compilation, GC, sandbox, performance).

> However regarding the above, I know .NET programming and not MFC and in
> .NET it is very easy to create a web service for example and VC++ 7.x

You can thank java for this. You would not be a .Net programmer today
without java (AFAIK, it is responce of MS to Sun).



> > Compiler. C++ has extremely slow compiler (it produces tremendous

amounts of
> > info and processes them). The compiler is extremely stupid. You can

create a
> > cl*** (in a file) which is compilable. The cl*** stops compiling once
> > attached to a project. Compiler shows a stupid message like "something
> > expected". Finally, you realize you have forgotten to put a closing

parensis
> > in some another file of the project. I favor any lang withour includes.


> And using what else instead?

Instead of what, includes? Do you know how includes differ from pascal
units/java imports?


> > Often messages like unresolved method appear and compiler cannot point

to
> > the line.

> ?

Yes, I always ask this question. Why stand-alone MS compiler is so stupid.


> > The need for .h files bizzare, interface must be typed twice.

Complicates
> > modifications.

> No it eases modifications. ***uming that you place declarations inside
> .h files only, you can change the definitions and not need to recompile
> the whole project, but only the modified files as far as the
> "signatures" remain the same.

What is the need to modify something in .h file just to recompile it?


> > Exceptions. not handeled exception shows you a reasonable error message

and
> > stack trace. It is allows to locate an error without using an IDE

debugger!
> It depends on the platform, the same things happen with my compiler. A
> stack trace is provided.

Are you about IDE? Any decent IDE can handle exceptions + stack. I'm about
runtime (no compiler, no debugger, pure JVM). Exceptions in C++ have no
common parent and I had a problem trying to cath them all. Furthermore, I
could not adopt using "finally".


> :-) Ok if you like Delphi better, use Delphi then. However I think VC++
> produces more optimised code and there are other C++ compilers too like
> GCC ports for Windows (MINGW, DJGPP), etc.

I have a softice always installed on my system (don't ask me why). Analyzing
the programs I have a picture of how different high-level constructions are
compiled. I've seen which codes produce both compilers. Therefore, I was
confident making the bet. The algorithm was the same, default optimizations.
Delphi compiler produced about 7 ASM lines of code in the main loop, VC++
had 2 lines more, we've got about 15% time difference. As high-level code
had the same number of lines as the optimized asm, I have doubts that it
will be possible to produce even more optimized code. And after that VC++
programmers are still ensured that their compiler is faster. Basing on what
do you make such statements? In my opinion, the more complex language
synthax makes it difficult to understand the code functionality to the
compiler. One old collegue told me that C++ is faster than Delphi because
C++ has minimal use of main memory (stack use). At the same time, he teached
me to use sdt::string. Where do you think the data is located? As i've
mentioned, I use softice for many years. The strlen function is called by
system hundreds of times per second. In which lang it is written? This is
one more about C vs. pascal performance misconception.




> So you can talk the language that you like and program in the language
> you like, while letting anyone else use whatever he likes too.

Most people do not have the choice.



> This is quite useless discussions since all those compilers including
> Java ones are all written in C++...

Java compiler is written in Java.




Best Regards


 
Old 06-20-2004   #106
.... ..nok..
 
Default Re: Java's performance far better that optimized C++

gaurav_7_7@yahoo.com (Gaurav) wrote in message news:<7113e26f.0406152345.2f01b86c@posting.google. com>...
> http://www.sys-con.com/story/print.cfm?storyid=45250
>
> Any comments?
>
> Thanks
> Gaurav



<QUOTE from http://www.sys-con.com/story/print.cfm?storyid=45250>
Lea used G++ (GCC) 3.3.1 20030930 (with glibc 2.3.2-98) for the C++,
with the -O2 flag (for both i386 and i686). He compiled the Java code
normally with the Sun Java 1.4.2_01 compiler, and ran it with the Sun
1.4.2_01 JVM. He ran the tests on Red Hat Linux 9 / Fedora Test1 with
the 2.4.20-20.9 kernel on a T30 laptop. The laptop "has a Pentium 4
mobile chip, 512MB of memory, a sort of slow disk," he notes.

The results he got were that Java is significantly faster than
optimized C++ in many cases.
</QUOTE>

It seems that last sentence should be as following:

"The results he got were that Sun Java 1.4.2_01 compiler is
significantly faster than optimized G++ (GCC) 3.3.1 20030930 (with
glibc 2.3.2-98)in many cases."

In other words the tests are not "C++ vs. Java Performance", but
"Optimized G++ (GCC) 3.3.1 20030930 (with glibc 2.3.2-98) vs. Sun Java
1.4.2_01 Performance".

--
Alex Vinokur
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn
 

Thread Tools
Display Modes





Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0