Re: Java's performance far better that optimized C++

From: valentin tihomirov (valentin_NOSPAM_NOWORMS_at_abelectron.com)
Date: 06/17/04


Date: Thu, 17 Jun 2004 11:20:23 +0300

I've heard such silly statements only from narrow-minded C/C++ programmers.

> > Every program you can write in C or C++ may be written
> > in any other-language that can emulate a Turing-machine
> > (Cobol, Fortran, APL, PL/!, Algol, Ada, Pascal, Java, C#, etc...).
>
> That's not really true. It's true that an algorithm that can be
> implemented in one Turing complete language can also be implemented in
> any other Turing complete language. Implementing an algorithm,
> however, is somewhat different from implementing a complete program or
> (as was mentioned earlier) something like an OS.
You don't make sense here. C++/Java are not the best candidates for
real-time programming indeed. But real-time system and OS are different
notions. Any program can be accomplished using memory-access only (ports and
special machine instructions are rate). What is the definition of "complete
program"?

> int *screen = (int *)0xb80000;
>
> will give you direct access to the machine's text-mode screen buffer.
> It's not portable, but for the target hardware it works perfectly
> well.
> Java doesn't allow things like that. Direct access to the hardware
> isn't portable in C or C++, but Java simply doesn't allow it at all.
I was asked not to call you C programmers but this is C code. It will fail
executing on a modern OS.
Any byte-array acces in java is a subject of boundry check indeed. However,
a cgi dll attached to a WEB sever is located in its address space. The
option for unlimited memory access, enabes your to fail the server
(unintentionally). As a designer, I will choose a tool that allows me to
accomplish faster (C/C++ compilers are slow, stupid and produce code often
slower than say Delphi compiler). Java sandbox targets reliable modules
which cannot distroy the rest of the system. Furthermore, Java allows for
exceptions which when not handeled show you a sensible error message with
the line of source code caused the error. Which is not possible in the case
of unlimited memory access (you get mem access violation dialog, don't
you?). These consiferations are often more preferred over direct memory
access in the modern SW design, espesially enterprise programming.

So, my point is that C/C++ programmers are convinced they are best operating
on pointers. What is a problem to write that line of code in, say Pascal?
TurboPascal even defines a special word for accessing abolute mem locations:
 var screen: array[0..N] of byte absolute $A000:$C000;

Finally, ANY memory access (say assigning a variable) is direct memory
access. Furthermore, don't you know about java HW processors? How will you
access HW in a Java-bytecodes-only system?
Real-time Low-power Java Processor aJ-100
http://www.systronix.com/jstamp/reality.htm

> In the end, there's another major problem: Java is defined as more
> than a language. Even if you accept source code that's syntactically
> identical to Java's, if you compile it directly to native machine code
> (other than for a Java machine) what you have isn't Java anymore.
> This means that attempting to implement a Java Virtual Machine in Java
> leads directly to infinite recursion -- to work, it HAS to be written
> in something else.
So, what is your point? Yes, Java is not only just a lang, it is a platform.
How do you implement a platform for C/C++ in these langs? I whould implement
HW in VHDL. Anyway, I can generate HW netlists in Java (manufacturing still
should be done on a factory).

So, stop blaming java, it is much more effective for modern
desktop/enterpricse programming that C/C++. I would still prefer
structural/functional c/pascal to asm/oop writing for real-time tiny micros.



Relevant Pages

  • What types of variables can be passed with JNI?
    ... My application is written mainly in Java, but it uses C/C++ through ... I purchased a OCR library which receives calls form the Java side using ... if JNI is up to the task. ... as said above, I know I can pass an int or a string ...
    (comp.lang.java.programmer)
  • Re: a good book
    ... My HTML knowledge is ... amd the latest edition of "The Javascript Bible". ... JS itself is pretty straightforward -- espeically if you already know C/C++ or Java. ...
    (comp.lang.javascript)
  • Re: Is VB Caca??
    ... competition to Sun's Java. ... it is beyond any doubt syntactically much more like C/C++ than it ... a Switch statement with the same "break;" ... It isn't that I don't want to believe it I just don't see the similarities ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Buildsysteme ... Erfahrungswerte?
    ... gibt es dafür eigentlich kein gescheites Tool ... C/C++ durchnuddelt. ... Java code base haben wollen/müssen ... ... eben "gut genug" werden. ...
    (de.comp.lang.java)
  • JTRES 2007 - 2nd Call for Papers
    ... Java Technologies for Real-Time and Embedded Systems ... Vienna University of Technology ...
    (comp.lang.java.help)