[geeks] Misuse of Java

Greg A. Woods woods at weird.com
Wed Nov 6 16:13:14 CST 2002


[ On Wednesday, November 6, 2002 at 16:18:40 (-0500), Joshua D Boyd wrote: ]
> Subject: Re: [geeks] Misuse of Java
>
> On Wed, Nov 06, 2002 at 02:21:46PM -0500, Greg A. Woods wrote:
> 
> > > That's my feeling, as well.  Java code doesn't -have- to be slow.  It's 
> > > inherently slower then the equivalent binary object code
> > 
> > From the studies I've read (possibly biased studies -- I wouldn't know
> > how to tell the difference :-), Java code is inherently slower than
> > pretty much every other interpreted or byte-compiled (or object-
> > compiled, though I haven't a clue what the latter could really mean)
> > code.
> 
> First, a note on object compiling.  To my understanding the term usually
> denotes a machine code compile,

Oh!  That kind of "object"!  :-)

OK, now it makes sense!  Too many objects!  GC!

(I immediatly thought of Smalltalk's method-compile mechanism where
source code is compiled into byte-code every time you submit a change to
the code browser and began to have visions of recompiling the whole base
object representation in a similar manner.)

> Anyway, as to the speed assertion.  Either you are leaving out some
> qualifiers, or those studies are wrong, I'm pretty sure.  Unless the
> language is severally flawed, you can say that any language is
> inherantly slower than another under any circumstances that I can think
> of.  You can compare compilers, and for interpretted languages you can
> compare run times, but I don't see anything about Java that would imply
> that it would be slower than Python.

The studies I've looked at compared real-world examples.

The canonical case study is detailed in "The Practice of Programming",
Brian W. Kernighan and Rob Pike, 1999, ISBN 0--201-61586-x (page 81)

(and for whoever first mentioned JIT (was that you?), well those timings
were done with JIT....  "Next!")

Mind you I haven't tried to duplicate those results and then added
anything else like Ruby, Python, various lisps and schemes, or Smalltalk
to the mix.....

> You could also assert that JIT code will still never be as fast as
> normally compiled code.  And certainly that is true in some reguards, if
> for no other reason that the time spent compiling the code.

nor the better interpreted languages, it seems.....

> But to say that stuff written in java reguardless of if it is running on
> an interpretter, a JIT, or was compiled to raw machine code seems very
> flawed to me.

I don't know about java compiled to machine ("object" :-) code, but it
seems JIT doesn't help worth a damn (or at least not enough).
 
> > > but there's a 
> > > lot to be said for optimizing your application, whether it's 
> > > interpreted, byte-compiled, or object-compiled.
> > 
> > Yup, but don't forget:
> > 
> >     Premature optimization is the root of all evil in programming.
> >         -- C.A.R. Hoare
> 
> I believe he (not Hoare, but the guy you replied to) was refering to
> doing things like picking the right algorithm, and I don't think that is
> what Hoare was refering to.

I'm pretty sure Hoare was talking about all kinds of optimisation,
including that of choosing more complex but potentially faster
algorithms.  He was definitely one of those guys who followed Einstein's
"advice".

> > Java, the best argument for Smalltalk since C++.
> > 	--unknown
> 
> I like that one.  Too bad it is unknown.

Could have been any of a dozen people.  This site (which has a number of
other real gems abut Java and other horrendous languages) does attribute
it to Frank Winkler, but I'm not sure it's right:

	http://www.sysprog.net/quotjava.html

I've seen several people, including Frank Winkler, and another Frank,
Frank Sauer, using that phrase in their ~/.signature without
attribution.  A guy named Phil Blake seems to win by date, at least
according to Google.

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods at ieee.org>;           <woods at robohack.ca>
Planix, Inc. <woods at planix.com>; VE3TCP; Secrets of the Weird <woods at weird.com>



More information about the geeks mailing list