[NTLUG:Discuss] Need some inputs on porting.

Stephen Davidson gorky at freenet.carleton.ca
Tue Sep 30 18:01:38 CDT 2003


Hi Steve.

Sorry to see you got struck by MS FUD.
Responses inlined....

Steve Baker wrote:
> Stephen Davidson wrote:
> 
>> Now a days, Java is just as fast (and in many cases is faster) than 
>> C/C++.
> 
> 
> Wooaahhh. That has to be HEAVILY qualified (and I'm trying hard not to
> start a language war here).
Lightly qualified, Java Version MUST be 1.3 or better, 1.4 or better preferred.
No language war, but I am going to supply updated information for those who
are still operating with older JVM performance information.

> For CPU intensive tasks where most of the time is consumed in the language
> itself (ie not waiting for hardware and not inside libraries that are not
> written in JAVA)...then JAVA is at least 50 times slower than C++.
>
In client mode, or with JIT mode, first pass will be slower.  Rest of the passes
will be up to speed.  JIT compiles on demand the bytecodes to platform specific
optimized machine code.

> If your application DOES spend most of it's time inside some other 'time
> sink' then JAVA can come close to the speed of C/C++ - but that's only
> because JAVA isn't doing anything - it's all being done by libraries that
> were almost certainly written in C/C++ and the JAVA code is just the 'glue'
> that holds together the parts that are doing all the work.
It is true that the time spent in Libraries, and how well the libraries
are written will affect the speed of the application.  Much time has been
spent in getting the Java Libraries speed optimized.

> So, it could *almost* tie with C/C++ for speed under those special
> circumstances - but there are no cases that I can imagine where JAVA
> would be faster than C/C++ (unless maybe there are JAVA libraries written
> in C/C++ that are somehow better written than the equivelent C/C++ 
> library -
> but that's a feature of the libraries - not of the language itself).
Normally true, but one needs to take into account the effects of the JIT
(Just In Time compiler) and the Runtime Profiler.  Many people don't,
and are therefore pleasantly surprised afterwards.  With the JIT providing
platform specific compilation and optimizations, and the Runtime Profiler
looking for ways to make the code run even faster, Java is no longer
a slow language.


> 
> That's not to say that JAVA is not the best choice in this case - speed
> isn't everything.
There are even Realtime Java Virtual Machines available today.  And there
are JVMs running on Fighter Aircraft Fly-by-Wire systems controlling the
control surfaces.

> 
> ---------------------------- Steve Baker -------------------------
> HomeEmail: <sjbaker1 at airmail.net>    WorkEmail: <sjbaker at link.com>
> HomePage : http://www.sjbaker.org
> Projects : http://plib.sf.net    http://tuxaqfh.sf.net
>            http://tuxkart.sf.net http://prettypoly.sf.net
> -----BEGIN GEEK CODE BLOCK-----
> GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M-
> V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++
> -----END GEEK CODE BLOCK-----
> 
> 
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss
> 


-- 
Java/J2EE Developer/Integrator
Co-Chair, Dallas/FortWorth J2EE Sig
214-724-7741





More information about the Discuss mailing list