Slashdot Mirror


Java Native Compilation Examined

An Anonymous Coward writes: "DeveloperWorks has an interesting article about compiling Java apps to run as native appplications on the target machine without the need for a JVM."

455 comments

  1. Well gee *that* makes sense.... by Anonymous Coward · · Score: 2, Insightful

    What's the point of taking a language that jumps through hoops to be "cross-platform" and cutting it's legs off?

    1. Re:Well gee *that* makes sense.... by Andrewkov · · Score: 2, Informative
      What's the point of taking a language that jumps through hoops to be "cross-platform" and cutting it's legs off?


      Huh? You still have the Java source .. You can compile it to a native executable for whatever platform you need, or compile it to Java bytecode. Obviously, compiling to a native executable is not applicable for applets served from websites, sending objects over the network, or Remote Method Invocation (RMI). The point of the article is that if you have a large, slow Java application, you can compile to run natively on a given platform to increase it's speed and reduce the disk and memory requirements.

    2. Re:Well gee *that* makes sense.... by CurlyG · · Score: 0, Offtopic

      ...and the value of *your* comment was what?

      Prat.

      --
      You know they call 'em fingers but I've never seen 'em fing. Oh, there they go.
    3. Re:Well gee *that* makes sense.... by Anonymous Coward · · Score: 0

      Go back to Massachusetts, pinko!

    4. Re:Well gee *that* makes sense.... by MisterBlister · · Score: 5, Informative
      Not everyone cares too much about binary cross-platform. Many people would be happy just with 100% source cross-platform porting, which doesn't exist with C/C++, etc.

      Further, not everyone even cares about the cross-platform nature of Java to begin with. I've worked on a few projects where the OS requirements were completely fixed but Java was chosen anyway -- for its rapid-design features (built-in garbage collector, nice network access classes, etc) rather than its cross-platform nature.

      All in all, its good to have a choice..Just because you can native-compile Java doesn't mean you have to do it.. And in situations where cross-platform is not needed, why not compile to native and get the extra efficiency? Choice is good.

      Its a shame Sun spreads so much FUD about native-compiled Java.

    5. Re:Well gee *that* makes sense.... by shrdlu · · Score: 3, Interesting
      What's the point of taking a language that jumps through hoops to be "cross-platform" and cutting it's legs off?

      It seems like you might not have read the article all the way through. It doesn't recommend only native compilation, but it does make a nice comparison between the two solutions. It points out when you might want to take advantage of native compilation, and when it doesn't help. You are always free to generate byte code in addition.

      Much of the work I do would be nicer and easier in Java than in other languages, but Java is just too slow and large for my purposes. This gives me the chance to use a language that has a little elegance, without giving up the speed of execution that I require. C++ just doesn't cut it, and it's tough trying to write this kind of code in C (but not impossible, it just takes a little discipline).

      Java isn't really cross platform anyway. Where's the JVM for MVS?

      --
      The difference between a Miracle and a Fact is exactly the difference between a mermaid and a seal. (Mark Twain)
    6. Re:Well gee *that* makes sense.... by zentec · · Score: 0, Offtopic

      About the same as your comment.

      So neah-neah

    7. Re:Well gee *that* makes sense.... by thomas.galvin · · Score: 4, Insightful

      The point of the article is that if you have a large, slow Java application, you can compile to run natively on a given platform to increase it's speed and reduce the disk and memory requirements

      Well, yes and no. There are some very slick Vms out there, and some very lazy compilers, though in most cases, you are correct, native code will execute faster than interpreted code.

      The disk requierments, though, can in the long run be larger for native code apps. The VMs have a lot of common tools (i.e. all of the java.* classes) available for any app that needs them. If you plan to compile to native code, you hav to link these in. You can save space by only linking in the libraries you need, but will still end up loosing space when you start installing mulitple applications that all include the SWING packages.

      I have been a bog fan of Java for some time, but the need for a VM held me back from a full-out endorsement for some time...it seemed like I was writing toy code because I needed another program to do anything with it, and I didn't like leaving all of those class files laying around. I have gotten over a lot of this, especially once I learned how to make an executable JAR file, and considering the widespread use of DLLs. Plus, I realy like being able to work on my text editor on my home WinXP box, and take it in and use it on our Sun achines.

      Still, I'm downloading one of those compilers right now. Why? Because native Java would just be neat. I probably won't even use it that much, but it will be nice to see that it can be done.

    8. Re:Well gee *that* makes sense.... by isolation · · Score: 0

      >wheres the JVM for MVS?
      Write one =P

      --
      Free Unix? Free Windows. http://www.reactos.com
    9. Re:Well gee *that* makes sense.... by Anonymous Coward · · Score: 0

      Go, read the article.

    10. Re:Well gee *that* makes sense.... by NickDoulas · · Score: 3, Insightful

      I agree. I think there are still a ton of benefits to Java without it being interpreted.

      It seems to me that most discussions of Java lose track of that fact that the key to the "write once run anywhere" idea is that the Java source code is translated to bytecodes and then executed in a non-ambiguous way. In other words, the language definition doesn't have all the "implementation defined" behavior that C/C++ language definitions have.

      It takes a lot of discipline to write truly portable C/C++ source code. It seems a lot easier to achieve this source code portability with Java. I think having bytecode portability is a big plus in some cases but not very important in others.

      So there's many ways to execute a given set of byte codes - strict interpretation, JIT compilation, native compilation, etc. This flexibility seems pretty good to me.

    11. Re:Well gee *that* makes sense.... by dadaist · · Score: 1, Interesting
      Bah.

      Binary cross compatibility doesn't exist with java in it's current state. Try byte-compiling on linux and then running it on windows.

      Until binary compatibility there is, running with java you will not.

      --

      ~
      MU!
    12. Re:Well gee *that* makes sense.... by Dragnet · · Score: 0

      You are a fool.

    13. Re:Well gee *that* makes sense.... by egomaniac · · Score: 4, Informative

      What VM are you using? I haven't seen a significant problem with moving apps between machine architectures since Java 1.3 came out.

      I do most of my development on a Windows box, and deploy to Solaris and Linux. It's been years since I've seen a bug only manifest on one of the three systems.

      --
      ZFS: because love is never having to say fsck
    14. Re:Well gee *that* makes sense.... by Anonymous Coward · · Score: 0

      Not everyone cares too much about binary cross-platform.

      So sez the short-sighted developer. A couple of years after the app has been maintained, management wants to move it to the new hot platform. What to do then? Waste time porting to the new platform? I guess that's you'll be doing

    15. Re:Well gee *that* makes sense.... by MisterBlister · · Score: 3, Insightful
      Try rereading my message.

      What you do in that case is pull the source code out of source control and recompile for the new platform.

      100% source code compatibility between platforms is insanely useful. 100% binary code compatibility between platforms, while nice, is not nearly as big of a deal for most systems... As long as you can easily recompile the original source and it runs the same, why not go for the extra efficienty of native if you dont need things like extensive runtime typing (reflection, etc)?

    16. Re:Well gee *that* makes sense.... by Anonymous Coward · · Score: 0

      the IBM jvm for MVS is on the IBM web site, as you would expect.

    17. Re:Well gee *that* makes sense.... by clare-ents · · Score: 3, Informative

      Exactly my experience, I've written a set of Oracle database administration tools with image display & mp3 playing capabilities, they were developed under Linux and run out of the box under Solaris, NT & OSX with a 1.3 runtime.

      I haven't had a single cross platform problem, the one component written in Perl/Tk has caused no end of grief though.

      --
      Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. (Einstein)
    18. Re:Well gee *that* makes sense.... by Anonymous Coward · · Score: 0

      this is fine when you're only dealing with four or five platforms/architectures, as we are now. but what about when you're Jini enabled printer wants to display status messages on your fridge (because the fridge has asked the nearest printer to list its inventory)? should the printer send its user-interface source code to the fridge for compilation? this is the type of situation java was designed for, and where it is also making big wins.

    19. Re:Well gee *that* makes sense.... by gorilla · · Score: 2

      There is nothing in theory stopping RMI from working even if the two ends are running two different languages. As long as there is a well defined API, where each end can understand the paramaters sent & received, then it makes no difference what the languages are. A good example of this sort of thing working would be COBRA, which allows basically any language to call methods in remote subsystems.

    20. Re:Well gee *that* makes sense.... by Anonymous Coward · · Score: 0

      Why doesn't HotSpot have a bin dump of its 'insanely' optimized native code?

      This way, you have a small and fast native app, and a smaller 'JVM' footprint that supplies the rest of the stuff you don't want natively compiled (like GC thread etc.)

      Unless I miss something, I'm sure this is technologically achievable on Sun's part, but they're not doing it for political reasons.

      Do people remember the days of JavaOS and Java chip? When the JVM is part of the OS, you can't call it 'virtual' anymore, and this subtle difference has a psychological effect on people so they will stop complaining about the JRE footprint etc: the JVM process is officially now part of the group of system kernel processes.

      So then JavaOS becomes a platform by itself and who knows if it will be compatible with any other platforms out there, especially if it starts to gain a significant market share. Just face it: IT business is 99% about market share and locking users in.

    21. Re:Well gee *that* makes sense.... by Nicolay77 · · Score: 1

      C++ 100% source code multiplatform compatibility ?
      Its possible, and indeed very nice and FAST AS HELL. Also, the GUI API is way better than the Java one. If you need that, then you should use wxWindows.

      The advantages of using Java are others, and have almost nothing to do with GUI and source code compatibility IMO. The best that Java has is serialization of objects. I can send full instances of objects through sockets over the net, save this objects to files and read them again, even in other OS, and it works very well. Implementing that in C++ is a pain.

      Garbage Collection? in a real program you should open files, and remember to close that files, open sockets and remember to close those sockets, etc. You should keep track of the resources you open and C++ destructors are for that. Remember: Java finalization is not guaranteed.

      --
      We are Turing O-Machines. The Oracle is out there.
    22. Re:Well gee *that* makes sense.... by Anonymous Coward · · Score: 0

      As a NeXT/OpenStep programmer, I don't understand why anytime a java native compiler is mentioned there's always an outcry about it violating a fundamental principle of java. There's still tremendous benefit in java being a 'write once, compile anywhere' language+GUI toolkit.

      As long as I don't have to port an application to yet another OS, I don't care if I need to produce another binary image.

    23. Re:Well gee *that* makes sense.... by Andrewkov · · Score: 1
      The disk requierments, though, can in the long run be larger for native code apps. The VMs have a lot of common tools (i.e. all of the java.* classes) available for any app that needs them


      The Java VM is a fixed size, containing all libraries. The native-compiled program will only need the libraries it needs, it is very unlikely to require every single library, so therefor would be smaller than the Java bytecode plus complete VM.

    24. Re:Well gee *that* makes sense.... by Anonymous Coward · · Score: 1, Insightful

      Not to mention that most platforms feature some sort of dynamically-linked libraries, so you could still reap the benefits of a single core Java installation, while (hopefully) improving execution time.

      A native-code compiler doesn't make Java any less portable. In a broad sense, it just lets the JVM do its work once, instead of repeating the same work every time a program is run. .class files would still be meaningful, both as a means of distribution, and to support applications such as Applets that actually need to be platform agnostic.

      I read a similar article in Byte magazine 5 years ago (give or take). It was a good idea then, its a good idea now.

    25. Re:Well gee *that* makes sense.... by Anonymous Coward · · Score: 0

      > Many people would be happy just with 100%
      > source cross-platform porting, which doesn't
      > exist with C/C++, etc.

      Whatever...my first job was working at a place that had the same C code running on 95, NT, Irix, Solaris, HP/UX, Digital Unix and AIX.

      I've had just as much trouble trying to make Java code run on the VM shipped with older versions of Netscape as tracking down differences in C compilers.

    26. Re:Well gee *that* makes sense.... by doyen · · Score: 1

      I must completely agree here. I have long thought that the Write Once Run Anywhere motto was just Sun propoganda meant to prey upon the technically illiterate. I'll admit though it has been a successful marketing ploy. I choose to program in Java because it is a clean language with a well thought out API and I'm less afraid of Sun trapping me into their product model than M$. The cross-platform independance was not a deciding factor. The reality is that I don't care if my binary will run across multiple platforms. As long as I don't have to modify my source code for my BSD app to run on Windows, I am a happy camper. As a developer, this would mean that I would have to compile my program 4 times instead of once and distribute 4 binaries instead of one. The minor convenience of having one binary isn't worth the performance cost. This is especially true in arena's, like GUI work, where Java lags behind.

    27. Re:Well gee *that* makes sense.... by civilizedINTENSITY · · Score: 1

      Funny, but thats exactly what I did when I took Java in college. We were required to turn in disks with both source and byte-compiled files. Everything byte-compiled on Linux (w/ Sun Java) ran on Win2k (w/ Sun Java) without exception. :-) Disturbed the instructor, which was a special bonus ;-)

    28. Re:Well gee *that* makes sense.... by civilizedINTENSITY · · Score: 1

      *not* porting! Recompiling. Without source compatibility you'd have to port. Porting from Linux to Windows MFC would suck, but recompiling under Cygwin is *much* simpler.

    29. Re:Well gee *that* makes sense.... by angel'o'sphere · · Score: 1

      There is nothing in theory stopping RMI from working even if the two ends are running two different languages.

      In theory yes.

      However RMI can far more than CORBA can.

      E.G. If I call from my machine a method in your applicatin via RMI, I pass objects serialized.

      E.G. you have a method: void doSomething(ClassType anObject), I can pass any object of type ClassType over to your machine, right?

      ClassType is a class. Thats why I named it like that and not a int or a sequence of bytes.

      So, no one prevents me to make on my side of the call a derived class: MyClass extends ClassType { ... } and passing an object of that class to you.

      Holla! But you do not know about my class. So .... if you call a method on the object I sent you, you boil out because you have not the code, right?

      Wrong :-)! RMI takes care to send also the necessary bytecode over to you :-) nice isn't it?

      So the main reason why native compilers are hard in supporting RMI is: they have to include the native compiler into the native application. They have to keep track which classes are where and which object belongs to which class and if they recieve a serialize dobject they have to realize if they know the class and ahve it allready compiled or if they need the class also.

      So they need to communicate with the sending VM and to fetch the byte code. then they have to compiler that bytecode and link into the existing classes.

      Unfortunatly they have to do that dynamic for all clasees referenced in the serialized object.

      So, if you like to suppport the advanced concepts of JAVA in a natve compiler you need to include a (rudimentary) VM into the native compiled application and the compiler itself also.

      OTOH RMI is build in a way that you can use your own transfer protocoll. The "data" transfer is seperated from the class transfer. While standard RMI is not realy fast your own ones might be very fast.

      Optional you can also do RMI via IIOP, the Internet Inter ORB Protocoll of CORBA .

      Regards,
      angel'o'sphere

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    30. Re:Well gee *that* makes sense.... by Fjord · · Score: 1

      Currently, my app hits a rare bug in the Solaris implementation of the com.sun.image.codec.jpeg package that shuts the VM down without warning. Granted this isn't under the java heirarchy and all com.sun stuff is caveat emptor, but it was pretty bad (now I detect the platform and use a PNG encoder on solaris).

      --
      -no broken link
    31. Re:Well gee *that* makes sense.... by chromosundrift · · Score: 1

      I develop/compile on linux and deploy on win32 (and mac).

      Works for me (filing in NON BUG).

    32. Re:Well gee *that* makes sense.... by big_hairy_mama · · Score: 2

      This has to be a troll or flaimbait, because that is just plain not true. The only problems Java has running cross-platform are certainly not related to binary or bytecode, they are if you use native libraries or don't do your file-system access correctly.

    33. Re:Well gee *that* makes sense.... by ttfkam · · Score: 2
      C++ just doesn't cut it, and it's tough trying to write this kind of code in C (but not impossible, it just takes a little discipline).

      What exactly can C do that C++ can't? C++'s std:string ends up comparable to C and char* in speed. C++'s standard quicksort algorithm is faster than C's (not as fast -- faster).

      Instead of taking "a little discipline" with C, why not spend some effort with a more advanced language?

      --

      - I don't need to go outside, my CRT tan'll do me just fine.
  2. It's about time! by khog · · Score: 1

    I was waiting for this to happen. The two things between Java and me are non-native code and some OOP problems (no operator overloads, etc). It's good to see new work being done on the VM side of things. Now I have to consider JSP as a possibility -- good good good!


    Mike.
    --
    http://www.yourmothernaked.com
    1. Re:It's about time! by Anonymous Coward · · Score: 0

      It will still be big kludge. They can't even innovate. they stole the idea from Microsoft. Microsoft is the true innovator.

    2. Re:It's about time! by angel'o'sphere · · Score: 3, Informative

      I was waiting for this to happen.

      Man, JAVA to native compilers exist since 1996 or even earlyer.

      Symantec Visual CAFE did it from the first release.

      If you enter "+java +native +code +compiler" into altavista.com, yahoo.com etc., you find at least 20 solutions providing that.

      The problem is: a java application on linux is no longer able to communicate via RMI or object serialization etc. with an other java application on Solaris or any other OS. You loose reflection support and similar low level access to the runtime environment.

      Its a common myth that java is (to)slow ... the way to compile it to native code exists since 3 month later since java was widely adopted.

      There is even a GNU implementation of a java to native code compiler, since ... 3? years?
      ---> gjc

      Regards,
      angel'o'sphre

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    3. Re:It's about time! by Anonymous Coward · · Score: 0

      i'm currently working on an operator overloader and code nativizer for java. i'll keep everyone posted.

    4. Re:It's about time! by bugg · · Score: 3, Insightful

      Operator overloads make it *way* too easy to write code that is difficult to follow. The ability to add, subtract, etc. objects *rarely* makes perfect sense when you consider everything that the object represents. Really, the lack of operator overloads is not a big deal, perhaps even an advantage, if you ask me. (IMHO)

      --
      -bugg
    5. Re:It's about time! by Anonymous Coward · · Score: 0

      I really don't think that it is a myth.

    6. Re:It's about time! by LoseNotLooseGuy · · Score: 1, Funny

      You loose reflection support and similar low level access to the runtime environment.

      I do not think you would "let loose or release" reflection support and similar low level access; it is more likely that you would fail to retain this functionality. The word you were looking for is lose.

      Congratulations! You have been participant #14 in my campaign to rid Slashdot of this error. (I nearly permitted you to escape due to your .de address, but upon reflection I realized that my message must reach the masses.)

      --
      Proudly correcting Slashdot's most irritating linguistic error since 2002.
    7. Re:It's about time! by Anonymous Coward · · Score: 1, Insightful

      I would argue that .equals and .plus make code more difficult to follow. The anti-overloading arguement always goes: "Someone will overload operator== to delete files."

      But that same person can just call their Java file deletion function .equals().

      So the so called 'advantage' is just more marketing bullshit.

      And how about the case of a Matrix class? Which is more readable:

      Matrix b = a.plus(b.multiply(c));
      vs.
      Matrix b = a + b * c;

      Using template trickery (see Blitz++ for examples) you can even optimize away all the implicit temporaries in the C++ example. With Java, you're stuck both with the less readable code, _AND_ unneeded temporary objects.

    8. Re:It's about time! by gUmbi · · Score: 2, Insightful

      But that same person can just call their Java file deletion function .equals().


      Of course they can..and that person would be a goddamn fool.

      The point is that an operator overload might make complete sense to the person that programmed it. The next person who looked at it may have used a different convention and interprets it differently.

      As an example, I overload (file--) to delete the file. But the convention you read in the latest issue of 'L33T Developer' indicates that (file--) should mean close the file handle. You look at the code, make somes changes and your clients file was just deleted.

      And BTW, I would never have called a function that deleted a file .close()

      Jason.

    9. Re:It's about time! by borgboy · · Score: 2, Insightful

      A common complaint of people writing in a language that lacks feature x is to declare feature x useless or dangerous. Operator overloading makes sense in certain situations, especially where math semantics are being modeled.
      Are operator overloads misused? Sure. So are knives, but that doesn't mean that cooks shouldn't use knives.

      But you wanna talk about language features that Java lacks? How about enums? Why leave those out? And whats with this whole "bean" concept? Why can't that be a first class concept with real syntactical support instead of this asinine get___ set___ crap?

      I could be biased, though.

      --
      meh.
    10. Re:It's about time! by n1k0 · · Score: 2, Informative

      > (no operator overloads, etc).

      Here you go. ;-D

      What's etc?

      niko

    11. Re:It's about time! by Anonymous Coward · · Score: 0

      Excelsior JET, Professional Edition is a native compiler that fully supports AWT/Swing, reflection, dynamic class loading, etc.

      Want proof? Download their fully functional evaluation package.

    12. Re:It's about time! by Anonymous Coward · · Score: 0

      Polymorphism is part of the defininition of an OO language. The idea is that you should be able to call equivalent methods on different objects by the same name. If we can have a 'toString()' method which works on everything, why can't we have a '+' method that works on Double and Integer objects? Every other language (not just C++) claiming to be OO does (something like) this. Not Java. So we are stuck with having to write a.doubleValue() / (b.doubleValue * c.doubleValue()) instead of a / (b + c). Java sucks. Vastly superior languages exist (and I don't mean C++), but you people are too lazy to seek them out.

    13. Re:It's about time! by Anonymous Coward · · Score: 0

      You are dead on...here's a quick quiz, which is more readable:

      mylist >> a
      mylist b

      or

      mylist.sortAscending(a);
      mylist.sortDescending(b);

      You save some keystrokes, but the second case is more explicitive as to what you are doing.

      -Chris

    14. Re:It's about time! by e-Motion · · Score: 1

      The point is that an operator overload might make complete sense to the person that programmed it. The next person who looked at it may have used a different convention and interprets it differently.

      Named member functions are not saved from abuse.

      As an example, I overload (file--) to delete the file.

      In a nutshell, this reads "decrement file". If you were to write a member function that did this and meant the same thing when read, you might call it decrement(). Both are equally absurd.

      "WTF does file-- mean?"
      "WTF does file.decrement() mean?"

      It's all about convention. Operator overloading is not something that you play with "just because". You're not going to make the -- operator delete a file, because nobody in their right mind associates it with deleting files. You use operator overloading to improve readability by allowing the programmer to use an operator to express the generally understood meaning for that class. Anyone who ventures from the beaten path and changes the meaning of the operator dramatically is only obfuscating his source. Does that mean that nobody should be allowed to do it? IMHO, no. It has its advantages, when used properly. We can ignore the fools.

    15. Re:It's about time! by khog · · Score: 1

      The cetera are no namespaces, an irritating class naming scheme (I'm a lower-case man myself), no templates (I may have just not learned this -- I must confess [as other posters have duly pointed out] that I gave up on Java rather early), and the return to C-style I/O. I was just getting used to streams, too...

      I shouldn't shortchange Java, though. Java's multiple inheritance is easier to grok than C++'s, so it gets props for that. And the JIT compiling wasn't an altogether bad thing, just not enough. Java reminds me of the sub-notebook computers -- it's just looking for a use, but it can't find one. It's not really powerful or linguistically complete (that's an odd extension of programming 'language') to be used for the development of critical applications, but it's also not as light-weight or simple as JavaScript or (the hardly light-weight or simple) Perl.

      Mike
      --
      http://www.yourmothernaked.com
    16. Re:It's about time! by angel'o'sphere · · Score: 1

      I will try to bear that in mind.

      The problem is you speak "lose" and "loose" equaly.

      And when I type I have only the sound in my mind.

      I translate the sound to letters.... sorry, I make a lot of errors by that. Even in german :-)

      (how often I'm mixing up piece and pease, yeah I know there is a little differecne in sound here ...)

      Regards,
      angel'o'sphere

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    17. Re:It's about time! by LoseNotLooseGuy · · Score: 1

      Very well, angel'o'sphere, you are forgiven. :-)

      For future reference, there is a slight difference in the pronunciation here:

      • The 's' in "lose" sounds much like the 's' in your "lesen" (auf Deutch). More of a 'z' sound.
      • The 's' in "loose" sounds like the 'ss' in your "Schloss".
      --
      Proudly correcting Slashdot's most irritating linguistic error since 2002.
  3. So... by Wakko+Warner · · Score: 0, Troll

    ...people are finally admitting that Java isn't too speedy?

    - A.P.

    --
    "Remember when the U.S. had a drug problem, and then we declared a War On Drugs, and now you can't buy drugs anymore?"
    1. Re:So... by Anonymous Coward · · Score: 0

      Like they would admit that. They already sold most of corporate America on it, and I have yet to see a production Java application which does something of substance.

    2. Re:So... by minus_273 · · Score: 1

      actually.. limewire does the trick quite well...as much as i hate to admit it.. java has its uses

      --
      The war with islam is a war on the beast
      The war on terror is a war for peace
    3. Re:So... by Anonymous Coward · · Score: 0

      If you write code in Java and it's slow, it's because you are must not be such a great programmer. If you'd sharpen your programming skills, you could write Java code that meets the business requirements in the speed that the solution requires.

    4. Re:So... by Anonymous Coward · · Score: 0

      If you'd take your head out of the sand, you'll see enterprise Java applications all over the place. There are probably a million Java programmers out there making much more money than you do.

    5. Re:So... by Anonymous Coward · · Score: 0

      They are building, but they are not in production. Show me one that lives up to the hype.

      And yes, they are overpaid, but so am I.

    6. Re:So... by Wakko+Warner · · Score: 1

      Limewire isn't exactly what I'd call lightweight.

      Useful, perhaps, but fleet-of-foot it is not.

      - A.P.

      --
      "Remember when the U.S. had a drug problem, and then we declared a War On Drugs, and now you can't buy drugs anymore?"
    7. Re:So... by Twisted+Mind · · Score: 1

      Come out of your cave!

      Java is everywhere serverside, there are a lot of companies, websites that use java as jsp or servlets e.d.

      On the client-side there are quite a few java-applications too, besides Limewire there are a few IDE's like JBuilder, EClipse and Forte (where the first too are quite fast for ide's too), also, a lot of websites use applets.

      With Java-webstart, more java-applications will be introduced, since it'll make client-jvm installation a breeze.

      --
      (-% TwistedMind %-)
  4. Oh, it's there, alright by Anonymous Coward · · Score: 0

    The JVM essentially gets embedded into the final executable. While there are some areas that will benefit by being compiled to native code, other bits will necessarily need to remain at a level that a VM will be able to get at.

    It's a pretty cool idea, but CPUs don't supply some features that make Java (and other interpreted languages) so cool.

    1. Re:Oh, it's there, alright by number+one+duck · · Score: 2

      I've seen a few php 'compilers' that do the same thing. They basically jam the executable and the script together in a self extractor, and let them sort themselves out... slowly.

    2. Re:Oh, it's there, alright by Mr+Teddy+Bear · · Score: 1

      People have been doing something similar to this for years. The original versions of Quick Basic (not QBasic) did just this.

      Better yet... up until I believe VB5 (maybe 4 or 6) you HAD to have that vbrunxxx.dll. What do you think THAT was? It was the BASIC intrepreter. I have never liked this and I personally probably never will. But to each his own.

      Java could still turn out to be a great platform... but I don't think that by taking away Java's key functionality it will achieve that. If you want something to be compilied natively use C++, or even *gasp* Pascal. C, C++ are close enough (if you use ANSI compliant) to where porting isn't too difficult, and the speed is much better. Java is for the people who NEED to have one app run on any platform. It has its use... it does very well with it. So if it ain't broke......

      By the way... I heard rumors a couple years back of a Java OS. Anyone heard anything more about it?

    3. Re:Oh, it's there, alright by nutsaq · · Score: 1

      re the java OS:

      i recall sun sticking a fork in it around 1998

    4. Re:Oh, it's there, alright by thomas.galvin · · Score: 1

      It's a pretty cool idea, but CPUs don't supply some features that make Java (and other interpreted languages) so cool.

      I've had this discussion with a lot of people...

      "You can't do [xyz] in C, but you can in [language of choice]."

      "Really? What do you think the [language of choice] interpreter is written in?"

    5. Re:Oh, it's there, alright by Sivar · · Score: 1

      LOL, good argument. In my experience, C can do everything except certain very specific platform dependant things that ONLY assembly can do. What, really, can literally not be done in C that can be done in any other HLL?
      Certainly, things can be done more easily, or faster, or more quickly, but as far as a specific programming task that C simply cannot do--I have yet to see one.

      --
      Computer Science is no more about computers than astronomy is about telescopes. --E. W. Dijkstra
    6. Re:Oh, it's there, alright by Anonymous Coward · · Score: 0

      It's the VB runtime, which is different from an interpreter. Learn the facts

    7. Re:Oh, it's there, alright by Anonymous Coward · · Score: 0

      There are native compilers that only support so called close-world programs (i.e. all classes are known at compile-time) - JOVE is an example.

      There are indeed native compilers that included a JVM in runtime for interpretation of classes not known at compile time (RMI Distributed Class Model and Dynamic Proxy API are two common sources of such classes) - TowerJ is an example.

      There is however one native compiler that addresses this problem through providing a caching JIT compiler that produces native code DLLs. The DLLs may be cached, so if next time the app loads the same class, the respective DLL shall be loaded from the cache. Of course there are consistency checks.

      The compiler is called Excelsior JET

      Besides, the Personal Edition is free, though it does not have that Caching JIT stuff.

    8. Re:Oh, it's there, alright by Mr+Teddy+Bear · · Score: 1

      It's the VB runtime, which is different from an interpreter. Learn the facts

      Ummm.. ok.. lets look at what the VB runtime is. It is the native code for all the stuff found in an EXE created by VB. The EXE calls upon this DLL to do even the most basic funtions... (like evaluating an expression). This might be more like a virtual machine, but personally I think Virtual Machines are nothing more than beefed up interpreters.

      If it ain't native code then it is intrepreted.
      On a side note: I was simply pointing out that this practice exists. I wasn't totally faulting anyone for using it. Personally I think every tool has its place, and only the fanatical idiots will deny that. (Except the PC Jr. that was just a dumb idea altogether)

  5. What about Java's safety advantages? by Ryu2 · · Score: 3, Interesting

    Runtime bounds checking, typecast checking, etc... do those get included in the native executable as well (and if so, then wouldn't the performance hit negate the advantages gained thru native compilation?), and if not, then it could be dangerous.

    --
    There's 10 types of people in this world, those who understand binary and those who don't.
    1. Re:What about Java's safety advantages? by andres32a · · Score: 2

      Actually i believe tha implementing Runtime bounds checking, typecast checking and so on wouldnt be easy to include un the native executable... as said in the article :
      Diagnostic tools can be somewhat thin on the ground, which makes it potentially more difficult to diagnose problems that occur in natively compiled Java apps (particularly if the error doesn't occur in the Java bytecode version!)

    2. Re:What about Java's safety advantages? by fidget42 · · Score: 1

      You could go throught the same type checking that Ada does. With "checks on," you get all inline type and range checking (OK, type checking happens at compile time) and when you "trust" your application, you compile with "checks off."

      --
      The dogcow says "Moof!"
    3. Re:What about Java's safety advantages? by norwoodites · · Score: 0

      In gcj you can turn off bounds checking, -fno-bounds-check.

    4. Re:What about Java's safety advantages? by cyberlync · · Score: 1


      Actuall Ada95 has these things and on modern architectures the speed diffrence is unnoticable.

      --
      I'm a programmer, I don't have to spell correctly; I just have to spell consistently
    5. Re:What about Java's safety advantages? by snowman153 · · Score: 1

      Excelsior JET implements all Java checking. Some chekcs may be turned off, but they are on by default. The benchmarks which results are published on our Web site were compiled with all checks enabled. You may download the respective build/run scripts and an evaluation copy of JET and compare on your system.

    6. Re:What about Java's safety advantages? by tommck · · Score: 2
      C++ has typecast checking (if you use dynamic_cast()) it does not have runtime bounds checking on basic arrays, but it does if you use STL containers.


      I don't see where there's a problem. It's all just code. It gets compiled. End of story.

      T

      --
      ---- It puts the lotion on its skin or else it gets the hose again. It does this whenever it's told.
  6. An interesting conversation. by ZaBu911 · · Score: 0, Offtopic

    This happened today at school. Annoyer: Java rocks! Me: Java is too slow. C++ is faster. Annoyer: Java rocks with JIT compiler! Me: You idiot.

    1. Re:An interesting conversation. by angel'o'sphere · · Score: 0, Flamebait

      ZaBu911: you idiot :-)

      If you are still at school you either are an incredible genius or for every problem you solve in C++ a likewise java program is
      a) equaly fast or faster
      b) crashes not under circumstances your c++ version will crash
      c) or if it crashes it will give a meaningfull error message from the VM while exiting, like "Out Of Memory Exception".

      I wrote 12 years C++ programs. I consider me in the same league like Andrew, Jimmy and Bjarne(probably 2 years below).

      I write JAVA since 4(>) years.

      If a program is slow, 90% of the time its the programmers or designers fault.

      Since JIT compilers for JAVA are in common use, a lot of other /. posts showed that, JAVA is not slow.

      I think the idiot in this case is you.

      Regards,
      angel'o'sphere

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    2. Re:An interesting conversation. by Anonymous Coward · · Score: 0

      "I consider me in the same league like Andrew, Jimmy and Bjarne(probably 2 years below)."

      Your post is further proof (as if we needed any more) that people with the least skill and knowledge are always the loudest and most arrogant.

    3. Re:An interesting conversation. by Anonymous Coward · · Score: 0

      and your post proves that Java-hates win out-right on the stupid-arrogant-load-mouthed-twits award.

    4. Re:An interesting conversation. by Anonymous Coward · · Score: 0

      Maybe I am just nitpicking here... but Java is spelled like "Java" not "JAVA" It is not an acronym. It does NOT stand for "Just Another Vauge Acronym".

      You idiot. :-P

  7. AS400 native compilation by titus_groan · · Score: 1

    On the AS400 you can run your jars through a compilation process. Whenever the jar is referenced by the system the compiled code is picked up and run. We haven't seen particularly performance improvements from this, but I guess it depends on the sort of work your code is doing...

  8. Finally! by tulare · · Score: 2

    This would solve my greatest beef with Java - that messy JVM which piles into the processor when it compiles bytecode. Of course, the idea of running Java natively seems to defeat the purpose of Java entirely: runs the same on any computer. Interesting idea, though...

    --
    political_news.c: warning: comparison is always true due to limited range of data type
    1. Re:Finally! by Anonymous Coward · · Score: 1, Interesting
      that messy JVM which piles into the processor when it compiles bytecode
      *bzzzt* Wrong, but thanks for playing.

      The two things that throttle Java's performance are Swing and the garbage collector. Swing isn't *that* big a deal -- like Mozilla's XUL it's been sped up over time -- but doing garbage collecting is a very complex task and will probably eat up CPU cycles like mad for at least the near future.

      That isn't to say garbage collection is necessarily a bad thing -- it's good for security and portability (the two things Java really aims for) since it eliminates the need for all those nasty pointers. But it's the main reason C++ code can runs circles around similar Java code. And doing native compilation won't help the situation any.

    2. Re:Finally! by PD · · Score: 2

      Garbage collection in an interpreter or virtual machine might be a big factor, I don't know. But I do know that garbage collection in compiled code does not need to be slower. Either you've got to free the pointers manually, and do the bookkeeping yourself, or the collector has to do it. The workload is the same either way.

      Check out the Boehm conservative collector and read what Hans Boehm has to say on the subject. I think he qualifies as an expert, since he is a mind behind both the Boehm collector (free beer and speech) and the Great Circle collector (proprietary).

    3. Re:Finally! by Anonymous Coward · · Score: 1, Interesting

      Have you benchmarked the Boehm collector?? (incidentally, it is the collector used by GCJ).

      Its a reasonably fast GC, especially if you turn off incremental collection.

      Its still a 50% slower than manual memory management on a good day. And you can get a lot faster than either manual or mark/sweep GC with an intelligent hybrid of manual management, pools, and custom allocators. Of course, you pay for that speedup in terms of requiring more sophisticated (read expensive) developers.

      Which brings us to the real reason people use Java. Java programmers are cheaper, since you can hire less skilled programmers and not worry about then leaking memory all over the place or blowing away unrelated parts of memory. This effect, along with rampant VM bugs, explains why use of Java doesn't increase software quality.

    4. Re:Finally! by Anonymous Coward · · Score: 0

      Java Developers certainly aren't cheap, and are often highly skilled.

      Where employers save money with Java programmers is that by using Java, development time is usually quicker than, C++ for instance.

      There are many C/C++ programmers that have learned Java, because of job opportunities, but Java Developers are not cheaper, more efficient maybe, but not cheaper!

    5. Re:Finally! by Mindbridge · · Score: 1
      This effect, along with rampant VM bugs, explains why use of Java doesn't increase software quality.

      This has to be the most erroneos statement I have seen in a long time. Java programs tend to be an order of magnitude more stable than comparable C++ programs and are usually developed in half the time.

      Which brings us to the real reason people use Java. Java programmers are cheaper, since you can hire less skilled programmers and not worry about then leaking memory all over the place or blowing away unrelated parts of memory.

      First of all, Java programmers are not cheaper. On the contrary, J2EE developers tend to get some of the highest salaries in the industry.

      And the real reason why people choose Java is that it allows them to concentrate on the design of the application, rather than worry about idiotic things like leaking memory, uncaught exceptions, and buffer overflows.

      Java does have things to be criticized for, but this post is so much off the target, that it is sickening.

    6. Re:Finally! by Anonymous Coward · · Score: 0

      Wow, the unsupported anecdotes come out in force when you score a hit on these Java monkies.

      J2EE programmers are a dime a dozen these days. We get so many resumes that we don't even hire people who don't have experience with C++ too. Not because we do any C++, but because we get far better programmers that way.

    7. Re:Finally! by Mindbridge · · Score: 1

      A post that did not give a single factual argument to begin with and was so wildly incorrect does not deserve the time for a factual response. If you really want facts, why don't you start first?

      And just for the record, this "Java monkey" has over 10 years of C++ experience, a number of commercial products and easily over 1 mil lines of code in that language behind his back, so it would be pretty hard to accuse him of bias.

  9. Security by vchoy · · Score: 1

    If the code is in native binary form and not bytecode, I guess it would make it harder to reverse engineer. I don't have to run those obfuscation-wares everytime I build. Saves time (both in building and running)

  10. Not new ... ho hum by Evil+Pete · · Score: 5, Insightful

    Lets see TowerJ has been out since when ? 1999. Having tried my hand at this I have some reservations. The project I was on ... a large dinosaur of a thing which will remain nameless had 12,000 classes which TowerJ turned into C files which were then compiled by GCC. Resulted in 50 megabyte executables on a Sun. Didn't really solve the problem which wasn't really about speed but throughput. The solution was a better design using servlets and Java Webserver ... result DRAMATICALLY faster without any need for native compilation.

    Mind you I noticed in the IBM article that the memory footprint was much smaller. That might be nice.

    --
    Bitter and proud of it.
    1. Re:Not new ... ho hum by tommck · · Score: 2
      Come on! Generating C++ classes is NOT a decent way to compile.

      I vehemently agree that design is often (not always) the solution for speed issues. PHBs, though, see the possibility of buying a tool for $X that will immediately give the app a Y% increase in speed and they'll jump on it every time

      T

      --
      ---- It puts the lotion on its skin or else it gets the hose again. It does this whenever it's told.
    2. Re:Not new ... ho hum by Anonymous Coward · · Score: 0

      which is, of course, the smart thing to do when the cost in people time (people * hourly rate * hours required to redesign for a y% speed increase) is greater than $X.

  11. AWT support a must by Coulson · · Score: 5, Insightful

    Most notably, there is very little support for AWT, making GCJ unsuitable for GUI applications.

    That's the real shame of the matter. Java shines most in its ease-of-use for creating complex GUIs -- unfortunately that's also where the worst memory/performance problems appear. For instance, Swing is good for client apps if you can ship with minimum RAM requirements of 64+ mb (and even that's cutting it close). Performance is most important in the UI, where the user notices any lack of responsiveness. Hopefully some Java native compilers will help out here.

    Different compilers support differing levels of class library; Excelsior JET is one compiler that claims to completely support AWT and Swing.

    Maybe there's hope yet!

    1. Re:AWT support a must by SageMadHatter · · Score: 1

      Java shines most in its ease-of-use for creating complex GUIs

      That is absolutely noti the case. As the GUI developer and designer for my company, I've come to hate the Swing library packaged in JDK. It's atrocious when it comes to trying to develop anything beyond the simple window frame with a button.

      SageMadHatter

    2. Re:AWT support a must by norwoodites · · Score: 1, Informative

      A simple GUI java application now can run and be semi-usable in gcj (in 3.1) but there are still bugs and more to implement. Help either the Classpath or gcj, they are in the process of being synced up together (see http://gcc.gnu.org/java/).

    3. Re:AWT support a must by addaon · · Score: 4, Informative

      Having used JET somewhat extensively, I can say that Swing works beautifully in it... exactly as you'd expect, and at a reasonable speed, to boot. It doesn't make small applications, but it optimizes relatively heavily. There's more than hope: it's already there!

      --

      I've had this sig for three days.
    4. Re:AWT support a must by Anonymous Coward · · Score: 0

      > Hopefully some Java native compilers will help out here.

      GCJ sees its AWT bit finally added after some licensing change with its upstream provider (Classpath.)

      Read gcc.gnu.org/java , in the Gcj News section.

    5. Re:AWT support a must by Anonymous Coward · · Score: 0

      It's atrocious when it comes to trying to develop anything beyond the simple window frame with a button.

      What kind of mindless drivel is that?
      It's atrocious that someone pays you to be a GUI developer.

      Try using a decent IDE or RAD tool. Most of them allow you to easily point and click your way through a complex GUI built with various layout managers and constraints.
      If you then have your business logic separated into models (JavaBeans/EJB) then hooking up the GUI to the application's logic is trivial.
      You can even abrstract the traversal framework for your application so that the business process flow can be altered without hard coding button events to which dialog comes up next.

      Next time you think Java GUIs are too hard or repetitive to code, try using something other than a plain text editor.

    6. Re:AWT support a must by Anonymous Coward · · Score: 0

      >>Java shines most in its ease-of-use for creating complex GUIs

      Are you sniffing glue, dude?

    7. Re:AWT support a must by Augusto · · Score: 2

      Interesting, they have a free eval version, I'm going to try that.

      Do you know if they plan to provide 1.4 support anytime soon ?

      --

      - sigs are for wimps.
    8. Re:AWT support a must by SageMadHatter · · Score: 1

      Try using a decent IDE or RAD tool. Most of them allow you to easily point and click your way through a complex GUI built with various layout managers and constraints. The original poster was refering to complex GUIs. Using an IDE to layout a GUI, will not yield to be a complex one in my mind. So I suppose one will have to define what it means to be complex. Next time you think Java GUIs are too hard or repetitive to code, try using something other than a plain text editor. Did I say it was too hard to program? No. I was pointing out that Swing is not suited for making custom GUIs. Perhaps it is you who finds it difficult to code a GUI by hand, and thus use the aid of IDEs to layout the design. I would very much like to see you try to use Swing to produce a circular button that continously animates according to it's state. Or create a source editor, in which source code is colored coded along with a gutter and line number column. I'll like you to see you create a window that has a minimum/maximum dimensions. I'll like you to do something as simple as having a Swing window float on top of all other windows, whether it's active or not. I'll like to see you create a GUI in which an additional input panel slides in and out of view from within the appliation window. Most of what I just said is impossible to do within Swing, the rest is nearly so, that it's not worth trying. Unless you've actually spend time developing extensively on Swing and other forms of GUI development, don't bother replying. Using an IDE to drag and drop together your GUI, doesn't make you a programmer. SageMadHatter

    9. Re:AWT support a must by snowman153 · · Score: 1
      Yes we do. Excelsior JET 2.5 beta 2 supports JDK 1.4 Release Candidate. Final release is expected shortly after JDK 1.4 final release.

      Download here

    10. Re:AWT support a must by Procrasti · · Score: 1

      Unfortunately, what I think we really need is a GPL or BSD licenced JVM. Without one, you will never see a java application packaged into Debian and other free operating systems. For this to happen it must support AWT. JET looks good, but it fails the license test.

    11. Re:AWT support a must by Anonymous Coward · · Score: 0

      Perhaps it is you who finds it difficult to code a GUI by hand, and thus use the aid of IDEs to layout the design

      So it makes more sense to lose time writing monotonous code? When you start adding many widgets to a form and want any type of resizability, you need to use things like BorderLayouts and GridBagLayouts extensively. Writing good GridBagConstraints can be time consuming, therefore an IDE increases productivity. Real programmers are more intrested in getting an application done, not seeing how many keystrokes they can make.


      I would very much like to see you try to use Swing to produce a circular button that continously animates according to it's state.


      You're joking right?
      I'm not sure if you lack OOP concepts to the point that you don't know how to extend a simple component to paint it the way you want, or if you just don't understand graphics in AWT and Swing.
      Take a look at the look-and-feel classes, Mac's LNF uses round buttons, no magic there.
      Maybe you should just start out at the beginning with java for dummies or something like that.

      Or create a source editor, in which source code is colored coded along with a gutter and line number column.

      jedit does this and the source code is available.

      I'll like you to see you create a window that has a minimum/maximum dimensions.

      Simply add a ComponentListener to your window for componentResized events and keep the component within your wanted bounds.

      I'll like to see you create a GUI in which an additional input panel slides in and out of view from within the appliation window.

      Add and remove a component and animate on the event queue.

      Using an IDE to drag and drop together your GUI, doesn't make you a programmer.

      Oh, now I get it. Not using tools that make you more productive is what makes a programmer. Ok sure, whatever.
      Back in the real world a programmer uses the right tool for the job.
      Consider for example, the task of a complex order entry system, AR and AP systems and maybe some reporting on top of that all against Oracle or DB2.
      Do you ssh into emacs to write the app because your a 1337 haX0R? Sure, if you want to get fired.
      I'd suggest mapping it out in UML from the DB or to the DB, then using a nice IDE tool to create Entity beans from the UML and connecting it to a GUI or web client.

      Sure not all "real" apps are business data entry systems, nor do they require Swing. And I sure as hell don't recommend Java for the next killer 3D shooter.
      Swing is however great as a general purpose API for GUI clients and has gotten better with each version.

      Maybe if you had some real world experience you'd be better equipped to spread your FUD

    12. Re:AWT support a must by oznet · · Score: 1

      You don't need AWT/Swing. There are more than a few free GUI toolkits that you can hook GCJ'd apps to:

      Gtk+
      FOX
      wxWin
      TrollTech's QT

      and I'm sure others... If you like Java development, but never bought into the whole JVM thing, this is the way to go.

      Think of GCJ as a regular C/C++ compiler, except you can use Java as the language. Good stuff.

    13. Re:AWT support a must by kevlar · · Score: 1

      Does it work with JMF and its native libs?

    14. Re:AWT support a must by RossyB · · Score: 1

      Kaffe is a free JVM. It may not rock, but if you want to remain "pure" it is a choice.

      And last time I checked dselect on my debian box there were plenty of Java applications packaged...

    15. Re:AWT support a must by be-fan · · Score: 2

      You know the sad thing? These days GNOME and KDE have become so bloated that Limewire's Java GUI runs almost as fast as most KDE or GNOME apps on my PII 300.

      --
      A deep unwavering belief is a sure sign you're missing something...
    16. Re:AWT support a must by SageMadHatter · · Score: 1

      So it makes more sense to lose time writing monotonous code? When you start adding many widgets to a form and want any type of resizability, you need to use things like BorderLayouts and GridBagLayouts extensively. Writing good GridBagConstraints can be time consuming, therefore an IDE increases productivity. Real programmers are more intrested in getting an application done, not seeing how many keystrokes they can make.

      Not if you follow some very simple good coding standards. Lacking the ability to use GridBagLayout well isn't an excuse for using an IDE exclusively.

      You're joking right? I'm not sure if you lack OOP concepts to the point that you don't know how to extend a simple component to paint it the way you want, or if you just don't understand graphics in AWT and Swing. Take a look at the look-and-feel classes, Mac's LNF uses round buttons, no magic there. Maybe you should just start out at the beginning with java for dummies [amazon.com] or something like that

      I knew that you would pull that out as an example. No $h1t that you can paint circular buttons, but their context area still remains as a square. Just because it looks round doesn't mean it behaves at such.

      jedit [sourceforge.net] does this and the source code is available.

      Did you even look at the jedit code? The guy wrote it from the ground up, extending the most basic of Swing objects, JComponent. Meaning he didn't use any of widgets in Swing to form the gui. Technicaly he wrote it from scratch and simply used JComponent to have something to paint to.

      Simply add a ComponentListener to your window for componentResized events and keep the component within your wanted bounds

      This does not prevent a user from resizing a window beyond certain dimensions. They will stretch the gui and it will then get retracted, this is unaccaptable. Add and remove a component and animate on the event queue

      wtf is that suppose to mean? Swing is however great as a general purpose API for GUI clients and has gotten better with each version

      You've shown that you are a complete imbecile. Throwing examples into the air without fully understanding what you were presenting.

      Maybe if you had some real world experience you'd be better equipped to spread your FUD

      You are an egotistical dumbass. Please don't come on here and post as an anonymous coward who thinks he understands how things work, when you clearly don't. You proved this by given the most inane example, as JEdit to try to prove Swing is good. When in fact JEdit wasn't written using Swing! Freaking dumbass, geeze.

      SageMadHatter

    17. Re:AWT support a must by snowman153 · · Score: 1
      Yes, the current JET 2.1 works with JMF and we have customers successfully using it with JMF.

      See also the full list of third party apps, libs and APIs we've tested JET with - there are JET project files you may download.

  12. Benchmarks by Andrewkov · · Score: 3, Interesting

    The program used in the benchmarks was very simplistic .. I would rather have seen a program creating and destroying many objects of various sizes. In the nativly compiled version, how does garbage collection work? Is it possible to write AWT apps? Swing?

    1. Re:Benchmarks by Anonymous Coward · · Score: 0
      In the nativly compiled version, how does garbage collection work?
      Slowly.
      Is it possible to write AWT apps? Swing?
      Somebody hasn't been reading the articles . . .
    2. Re:Benchmarks by Anonymous Coward · · Score: 0

      The primes benchmark cited in the article rewritten in C++ is 3 times faster than Java. Gcj should have achieved the same results as C++ here. I wonder what went wrong. Perhaps the author was using a very old version of Gcj.

    3. Re:Benchmarks by jsse · · Score: 2

      The program used in the benchmarks was very simplistic .. I would rather have seen a program creating and destroying many objects of various sizes. In the nativly compiled version, how does garbage collection work? Is it possible to write AWT apps? Swing?

      and string processing too! It's a well-known performance handicap for java. SUN is heading the right direction to improve the performance of it in each version, I wonder how well IBM would perform in this battle? :)

    4. Re:Benchmarks by snowman153 · · Score: 2, Informative
      Some links to more extensive native compiler benchmarks:

      Osvaldo Pinali Doederlein.
      The Java Performance Report - Part IV: Static Compilers, and More. August, 2001

      The Java Performance Report is an independent study of Java performance, where both virtual machines and static compilers are evaluated. Part IV compares Excelsior JET and two other static compilers with Sun's HotSpot Server VM.

      Volano, LLC.
      The Volano Report. Dec 26, 2001

      The Volano Report covers VolanoMark(tm) - a widely recognized pure Java server benchmark characterized by long-lasting network connections and high thread counts. This report includes Excelsior JET a native compiler.

      Excelsior JET Benchmarks

      From Caffeine and SPECJVM through XML Transformations to Java2Demo and VolanoMark.

  13. Heh, to quote my professor. by Anonymous Coward · · Score: 0

    "Java is nice in the fact that you can do pretty much anything with it. However, while you're doing pretty much everything, you might want to look at other languages, which'll do specific instances of everything *better*."

  14. Microsoft .NET already does it! by Anonymous Coward · · Score: 1, Interesting

    This is built into the .NET Framework. Run ngen.exe on any .NET .exe or .dll and the MSIL is precompiled into an optimized native binary. In fact, setups for .NET apps can do this on the assemblies they install. Indeed, the .NET Framework actually precompiles its managed shared .dlls on install time.

    1. Re:Microsoft .NET already does it! by Anonymous Coward · · Score: 1, Informative

      What's cool about the .Net JIT system is that the MSIL is actually an intermediate stage of compilation (currently available for C# and VB.Net). The output of the JIT is an actual binary executable like those produced by C or C++, i.e. no runtime needed except when accessing .Net-specific functionality.

      With .Net there isn't any interpreter (unlike the current VB).

    2. Re:Microsoft .NET already does it! by Anonymous Coward · · Score: 0

      >by Anonymous Coward on Wednesday January 30, @10:24PM (#2928705)
      >This is built into the .NET Framework. Run ngen.exe on any .NET .exe
      >or .dll and the MSIL is precompiled into an optimized native binary.
      >In fact, setups for .NET apps can do this on the assemblies they
      >install. Indeed, the .NET Framework actually precompiles its managed
      >shared .dlls on install time.
      >
      Who cares?

    3. Re:Microsoft .NET already does it! by Lussarn · · Score: 2


      This is built into the .NET Framework. Run ngen.exe on any .NET .exe or .dll and the MSIL is precompiled into an optimized native binary. In fact, setups for .NET apps can do this on the assemblies they install. Indeed, the .NET Framework actually precompiles its managed shared .dlls on install time.


      And with .NET you wouldn't miss anything since it only works on windows. Until there is a framework for Unix, Mac and Amiga it shouldn't be compared to Java.

  15. Speed isn't the advantage of GCJ by Ondo · · Score: 2, Insightful

    The big advantage of GCJ isn't speed, it's the vastly better interface to C++ code (CNI vs. JNI). Of course, using that really does make your code non-portable.

    1. Re:Speed isn't the advantage of GCJ by Anonymous Coward · · Score: 0

      GCJ should be replaced with a C# compiler.

  16. What happened to Sun's Java chips? by Anonymous Coward · · Score: 0

    Those were supposed to run the bytecode natively in hardware, for blazing speed. Why haven't we heard anything more about them?

    1. Re:What happened to Sun's Java chips? by dstone · · Score: 3, Interesting

      Dallas Semi makes the TINI, a Java implementation in hardware packaged as a 72-pin SIMM stick. I have one and it's cheap and fun to program. Built-in ethernet, general purpose IO pins, etc.

      Go here for more info.

    2. Re:What happened to Sun's Java chips? by mlk · · Score: 1

      The newer SPARCs can do this.

      --
      Wow, I should not post when knackered.
    3. Re:What happened to Sun's Java chips? by gabbarsingh · · Score: 1

      Ajile's AJ-100 and AJ-80 chips implement native Java instruction set. You grab a development board from Systronix . Which means you write your device drivers in Java!

  17. Ahem by nice · · Score: 1

    I, personally, *resort* to Java only when I'm looking for a level platform-independence that can't be accomplished with Tcl. Is it really worth the hassle to not use an alternative langauge that is more efficient if we're targeting a single platform?

  18. Speed improvements very noticeable in PDAs by Bigger+R · · Score: 5, Informative

    Good progress is being made in native compiler for Palm OS. See http://sourceforge.net/projects/jump/

    and also http://www.superwaba.org for info on the related JVM for PDAs that it replaces.

    Good stuff.

    --
    Beta only seems to work for Google. Such a shame.
  19. Some thoughts... by funkhauser · · Score: 1, Insightful

    I always thought Java was very interesting with it's cross-platform compatibility and whatnot. But as everyone has noted, it's painfully slow. I always wondered why people hadn't implemented a native-code compiler for it. Sure, with bounds-checking and garbage collection, natively compiled Java will still be slower than natively compiled C++.

    The point is, Java is really just another programming language. What's wrong with allowing developers the opportunity to write their natively compiled software in a solid, object-oriented language that doesn't have all the backwards-compatability issues that C/C++ has?

    Whether this will be useful, I dunno. But it opens up options, and that's always a good thing.

    1. Re:Some thoughts... by Penrod+Pooch · · Score: 0, Troll

      The point is, Java is really just another programming language. What's wrong with allowing developers the opportunity to write their natively compiled software in a solid, object-oriented language that doesn't have all the backwards-compatability issues that C/C++ has?


      Well, I don't think there should be anything wrong with it. It is just that Java is a wholly-owned subsidiary of Sun Microsystems, and they don't let you do anything they don't like with it. Everyone should just go with a standardized language like C or C++ instead.

    2. Re:Some thoughts... by Anonymous Coward · · Score: 0

      Java is painfully slow? When was the last time you wrote an application in Java? 1.0? Get with the program... Java allows you to write enterprise solutions that run fast enough to get the job done. In the real world, writing applications in C++ that would run 1% faster would be way too expensive.

      Maybe when you graduate, you will learn about programming applications in the real world.

    3. Re:Some thoughts... by _xeno_ · · Score: 1
      Java AWT works like total and complete crap under Linux from my limited experience with it on that platform. (I think the last time I tried anything with it GUI-wise under Linux was with Sun's 1.3.1 JDK to use a fairly spartan custom Swing-based app.) Graphical-oriented Java works best under Windows - well, NT, really. If you're using Java GUIs under Linux then you can get the impression it's crap, which is really unfair to an extent for the underlying technology.

      Once you get into server-side technologies like servlets, Java starts to become a useful language. Thinks like ant are pretty cool - it's nice to be able to write build scripts that work under Linux and Windows.

      Tomcat is a very nice platform for writing web applications. At one point, I had a fairly interesting thing running through Cocoon 2.

      I can see why the wiz-bang graphical stuff turns people away from Java, but there really is a lot of cool things that can be done with it.

      --
      You are in a maze of twisty little relative jumps, all alike.
    4. Re:Some thoughts... by the+eric+conspiracy · · Score: 2

      I always wondered why people hadn't implemented a native-code compiler for it. Sure, with bounds-checking and garbage collection, natively compiled Java will still be slower than natively compiled C++.

      Hmmm.. It would seem to me that some run-time dynamic binding features present in a JVM would be lost in a native code compilation.

    5. Re:Some thoughts... by Anonymous Coward · · Score: 0

      as much as aI love Java, esp as a server app (running on a SPARC w/ a java proc ;), awt & swing are still slow.

    6. Re:Some thoughts... by FastT · · Score: 2

      Just brainstorming here, but what about making every Java class (or related group of classes) a shared library that can be dynamically loaded? Seems like you could fake class inheritance by using inter-library references and some infrastructure to fix-up the references dynamically. Polymorphism would be achieved by translating calls to "super" as calls to the "parent" library.

      --

      The only certainty is entropy.
    7. Re:Some thoughts... by snowman153 · · Score: 1

      To address this problem, a native compiler's runtime can include a JVM (like in TowerJ) or a JIT compiler (like in Excelsior JET). JET in fact has a Caching JIT - the DLL created from a dynamically loaded class shall be re-used when exactly the same class is loaded again. Somebody mentioned here that Java on AS/400 has a similar feature.

    8. Re:Some thoughts... by supersnail · · Score: 1

      Most people seem to be missing the main finding from the test :: IBM's JRE VM runs nearly as well as the compiled java. So if you want better performance get a better JVM? (( I am sure that Suns HotSpot would post similar results )).

      Just out of curiousity I compared the Java "primes" program with an almost identical C program on a Sun box and got the following results:-

      Suns Java VM -- 31 seconds.

      C program -- 23 seconds.

      Optimesed C -- 17 seconds.

      --
      Old COBOL programmers never die. They just code in C.
    9. Re:Some thoughts... by doug363 · · Score: 2

      There's a Java class called ClassLoader that allows Java programs to dynamically load classes at runtime. The classes can be stored somehow on the computer, downloaded over the network, or generated dynamically by the program if it knows the Java class format. You can make portable self-modifying code with Java ;). Basically, you can make your precompiled class files into shared libraries or whatever, but you still need to be able to handle bytecode class files received over the network, compiled with a source-to-bytecode compiler, etc.

  20. Re:What people should be asking about by Anonymous Coward · · Score: 0

    I hope you're not using university bandwidth to post racist messages. I don't think they'd like that.

  21. Obscurity by yerricde · · Score: 1

    I don't have to run those obfuscation-wares everytime I build.

    Obscurity != security. For every piece of obfuscation-wares, there's an equal and opposite piece of de-obfuscation-warez. Besides, what do you have to hide?

    --
    Will I retire or break 10K?
    1. Re:Obscurity by vchoy · · Score: 1

      For my own personal code I have nothing to hide...

      In accordance with my company's policy, I have to do what I am told.

  22. Garbage Collection Question by adamy · · Score: 3, Interesting

    Seems to me the problem with Java is that it waits until memory is full to garbage collect. In C++ Code, if you allocate and free a lot of memory, eventually you are going to fragment your memory to the point where you may not be able to allocate large enough memory blocks for your purpose. GC is supposed to get around that. But if C++ doesn't GC, how can a C++ app run indefinitely. I would really appreciate someone who understands the subtle nuances to explain. If there are better memory allocation schemes, couldn't you use them until you were forced to use GC?

    --
    Open Source Identity Management: FreeIPA.org
    1. Re:Garbage Collection Question by Anonymous Coward · · Score: 0

      When you free up memory from the heap it becomes useable for memory allocation again. You will have trouble if you run out of memory no matter what language you are in.

      GC doesn't buy you anything except the removal of one programming task.

    2. Re:Garbage Collection Question by Accelerated+Joe · · Score: 1

      Memory doesn't always fragment when you allocate and deallocate it. If you have a program which does a lot of allocation and deallocation, it is probably a good idea to write your own memory handling routines. For instance, make a queue of available storage space, and then pick already allocated memory. That avoids any memory fragmentation problem. This also avoids some cross platform weirdness which can cause a program to crash in um... unusual ways.

      Java is a whole other can of beans. They didn't want people worrying about their pointers, so they simply implemented a GC. I don't know of any situations where a talented programmer couldn't do better than Java's Garbage Collector, but lets face it, most people who use Java like the convenience, and some other people who use Java will never ever understand pointers.

      --
      They who would give up an essential liberty for temporary security, deserve neither liberty or security
    3. Re:Garbage Collection Question by dstone · · Score: 3, Informative

      I would really appreciate someone who understands the subtle nuances to explain.

      Bruce Eckel explains some different approaches to GC, pros and cons, etc., especially as it relates to Java. Check out Thinking In Java 2nd Edition, pp. 207-219. You can download it here.

    4. Re:Garbage Collection Question by Anonymous Coward · · Score: 0

      >But if C++ doesn't GC, how can a C++ app run indefinitely

      If your problem set doesn't scale over a couple of orders of magnitude in size, then don't use dynamic memory allocation. Even if it does, you might be able to allocate dynamically once at startup (when you know how much data you might be looking at).

      Otherwise, you'd be stuck having to come up with your own scheme that doesn't fragment. This might be easier than it sounds once you start looking at how memory is used -- you don't necessarily have to implement some crazy researcher's memory allocation scheme since you're just trying to get a single app's memory allocation to not fragment.

      Once you start to get into really high-performance or real-time applications, using the general purpose memory allocator can be a real time sink.

    5. Re:Garbage Collection Question by theCURE · · Score: 1

      quick addition is there are programs which optimizeit for you and tell you what to cut out to reduce collection, increase performance.

      --
      "i can never say no to anyone but you"
    6. Re:Garbage Collection Question by Coulson · · Score: 1

      Java also helps out by making use of handles. Because the VM manages all references, objects can be moved around memory. Think of Java references like C/C++ handles. The garbage collector works by marking used memory and compacting it, essentially defragging your heap with every gc() (or whenever the VM decides it's necessary.)

      The Microsoft VM allocates X amt of memory for the VM... when than X is fully utilized, it reallocs to get a larger heap and compacts the objects in memory. This way memory fragmentation never becomes a serious problem.

    7. Re:Garbage Collection Question by adamy · · Score: 1

      So what Java is lacking for true performance tuning is a memory allocation tie in? In other words, you write your app, see what is happening in memory, and write a memory scheme that optimizes for it. Seems like it would be easy enough to get Java to do that. Of course, the fact that you don't know when an object is done being referenced outside of the GC routines might be the problem. Is this so?

      --
      Open Source Identity Management: FreeIPA.org
    8. Re:Garbage Collection Question by Anonymous Coward · · Score: 0

      "Think of Java references like C/C++ handles."

      Presumably you mean C++ references, since C++ doesn't have "handles."

      But you're wrong (though its not really your fault, Sun's marketing department has been working overtime at this myth and the "Java is cross-platform" as opposed to its own platform myth). Java's references are actually just like C++'s pointers, only with pointer arithmetic disabled. C++ references cannot be NULL.

    9. Re:Garbage Collection Question by FastT · · Score: 2
      Seems to me the problem with Java is that it waits until memory is full to garbage collect.
      Your information is out of date. See the information on the HotSpot VM and its use of generational GC. Essentially, short-lived objects are GC'd frequently.
      --

      The only certainty is entropy.
    10. Re:Garbage Collection Question by ggeens · · Score: 1

      I think you're mixing two concepts here: garbage collection and heap optimization.

      A GC finds all unused objects and marks them as free. Heap optimization shuffles memory around to reduce fragmentation. Both systems can be implemented independently. (E.g., older versions of MacOS would reorganize the memory map of running processes from time to time, but AFAIK this wasn't a garbage collector.)

      The SUN Java GC does use heap compaction techniques, but this is not required by the JVM specification.

      In every correct application, heap space grows until an equilibrium is reached. The allocated memory may be fragmented, but new objects merely fill the "holes" left by previously released objects.

      Sometimes, an object is not deallocated after all references to it are cleared. This is a memory leak. A GC serves to find and release these objects. (You can still have memory leaks in a system with a GC: if the program keeps references to objects that are no longer used.)

      In a long-running program, those memory leaks will have a larger impact on the footprint of the process than those holes.

      --
      WWTTD?
    11. Re:Garbage Collection Question by Anonymous Coward · · Score: 0

      the os takes care of the memory fragmentation.
      page tables and such.
      the memory you access isnt REALLY contiguous ever.
      its in little pieces, with map to them that makes them look contiguous

    12. Re:Garbage Collection Question by hding · · Score: 3, Informative

      A good source for starting to address all of your garbage collection questions is Jones & Lins' book, Garbage Collection : Algorithms for Automatic Dynamic Memory Management. Another good source is The Memory Management Reference

  23. AmigaDE, Savaje, Symbian and Jeode by Quizme2000 · · Score: 3, Interesting

    I was a little disappointed in the selection of the the JVM's they selected for their example. Especially now that PDAs/CellPhones are now powerful enough to run real applications on the client. I have yet to see a StrongArm device ship with the Sun, IBM, or KaffeJVM, why, because they are slow. The JVMs listed in the subject line run 10-200x faster on devices. Soon we will see EJB and other J2EE compents on PDAs. As a developer of client java applications/applets I would never distribute a device specific application, it would be a nightmare to have 160 diiferent compiled versions of the same application. The good JVMs already have done that, and my code I compiled years ago works on the newest PDAs...So there

    --
    "Get them before they get....
  24. Living in the 70's my friend by Codex+The+Sloth · · Score: 1

    That isn't to say garbage collection is necessarily a bad thing -- it's good for security and portability (the two things Java really aims for) since it eliminates the need for all those nasty pointers. But it's the main reason C++ code can runs circles around similar Java code. And doing native compilation won't help the situation any.
    Garbage collection is not by definition slow and is generally the same as new/malloc -- although lots of people seem to think it is alot slower. For non-gui code and if your doing pure Java code (i.e. no JNI) the performence is rougly comparable to C++ (assuming you have a good JVM).

    --
    I am not a number! I am a man! And don't you ... oh wait, I'm #93427. Ha ha! In your face #93428!
    1. Re:Living in the 70's my friend by Anonymous Coward · · Score: 0

      "For non-gui code and if your doing pure Java code (i.e. no JNI) the performence is rougly comparable to C++ (assuming you have a good JVM)."

      No matter how many times you repeat this, it still won't be true.

      Try benchmarking it yourself. On a good day (code with very little garbage creation) and tight, simple loops you can get within 50% of the equivalent C++, but I've yet to see anyone claim Java is faster with any credibility. Just lots of painfully obviously flawed benchmarks from Java advocates who desperately want it to be true.

    2. Re:Living in the 70's my friend by tssm0n0 · · Score: 1

      Garbage collection is not by definition slow [iecc.com] and is generally the same as new/malloc

      But you have to admit there would be much more overhead. Its a matter of keeping track of what memory is not referenced, and that takes a lot of work for a machine, where most other languages the programmer would take care of all that in the code (hopefully).

    3. Re:Living in the 70's my friend by kinga · · Score: 1

      Its a matter of keeping track of what memory is not referenced

      Did you mean are referenced? GC (and I don't mean reference counting) doesn't keep track of dead objects, but instead tracks live ones, since you trace the transitive closure of all accessible roots.

      It is true, however, that in Mark&Sweep/Mark&Compact collectors you must visit the dead objects to reclaim them. Copying collectors do not share this problem.

    4. Re:Living in the 70's my friend by osu-neko · · Score: 1
      But you have to admit there would be much more overhead.

      Memory management takes a certain amount of overhead. There is no reason, in principle, for this overhead to be greater or lesser using automatic memory management (garbage collection). The same work is done either way, the only difference is how it is done.

      Its a matter of keeping track of what memory is not referenced,

      The primary activity of malloc (since it needs to know this in order to hand out memory). Malloc just needs more hints from the programmer than automatic GC does. Supplying these hints results in a certain amount of overhead that GC avoids. We can spend all day pointing out things that one approach needs (and consumes processor cycles getting) that the other does not. Why anti-GC zealots seem to think this is a one-sided issue is beyond me. Manual memory management doesn't work by magic, either. It requires overhead and processor cycles...

      and that takes a lot of work for a machine, where most other languages the programmer would take care of all that in the code (hopefully).

      In other words, rather than it being taken care of in the code (of the compiler/environment), it needs to be taken care of in the code (of the application). :)

      There are cases where manual memory management works faster than automatic, and there are cases where the reverse is true (consider how many cycles it takes to execute a "free" call vs. how many cycles it takes to not execute one -- some code will run faster under GC, especially a GC that doesn't need to visit blocks to free them).

      No one has to "admit there would be much more overhead". It depends -- some cases it can be less, some cases it can be more, in principle it ought to be about the same amount either way (the same job is being done, the only thing GC does is switch who's doing it). A poor GC will be slower than well-optimized application specific code, which was a historical problem, but as the author of this thread said, it ain't the 70's anymore...

      --
      "Convictions are more dangerous enemies of truth than lies."
  25. umm not news by SquierStrat · · Score: 1

    This has been happening for quite some time. Native code compilation of java is nothing new!.

    --
    Derek Greene
  26. How does GCJ perform by Danielle+Gatton · · Score: 1

    when it's set to produce bytecode? If it produces slow bytecode, then it wouldn't be that surprising for it to produce slow native code as well. This could just mean that it's immature and not well optimized. The article would've been more useful if he'd tried out more than the one native compiler, as well, since he lists eight of them.

    1. Re:How does GCJ perform by Anonymous Coward · · Score: 0

      > when it's set to produce bytecode?

      It produces fair bytecode. like javac.

      > If it produces slow bytecode, then it wouldn't be that surprising for it to produce slow native code as well.

      The bytecode backend is handcrafted and works nice. The native backend is gcj's back-end. They are two different things, although they're fed practically the same tree node representation.

    2. Re:How does GCJ perform by Anonymous Coward · · Score: 0

      > The bytecode backend is handcrafted and works
      nice. The native backend is gcj's back-end

      I meant gcc's back-end. Sorry.

  27. Another weak study... by Alea · · Score: 5, Insightful

    I'm not going to try to champion Java, JITs, or native compilation, I'm just going to point out what's wrong with this "study".

    This has to be the third or fourth weak study of Java performance I've seen over several years. Issues such as whether or not all Java features are in place in the native compilations (e.g. array bound checking, but note that GCJ turns this on by default) or what sort of optimizations are performed by the native compiler and JVMs are completely ignored. The author also suggests that compiling from bytecode to native code is the natural route when it's quite possible that gains could be made by compiling directly from source to native. While GCJ accepts either Java source or bytecode, it's not clear from the documentation I've read whether or not it first translates source to bytecode or goes straight from source to native.

    When comparing disk space, the author comments that an installed JVM can be up to 50 MB vs. 3 MB or so for libgcj. This is a ridiculous comparison since those directories probably include all of the tools, examples and libraries, and as far as I know, libgcj doesn't include the whole J2SE API set, so it's nowhere near a fair comparison. It's a pretty limited set of benchmarks for making these judgements too.

    I played around with native compilation of Java a few years ago. At one point (probably around 1996/7?) native compilers could offer noticable gains over Sun's JVM on a numerically intensive application (neural network stuff). However, after the initial versions of HotSpot and IBM's JIT, I couldn't find a native compiler that gave competitive performance on similar apps. I think this is largely due to underdeveloped native compilers with poor optimization (HotSpot is quite insane in its runtime optimizations).

    Anyway, I sure hope IBM doesn't pay too generously for studies this poor. Its final message is essentially "who knows?" - not terribly useful.

    Alea

    1. Re:Another weak study... by dvdeug · · Score: 4, Informative

      While GCJ accepts either Java source or bytecode, it's not clear from the documentation I've read whether or not it first translates source to bytecode or goes straight from source to native.

      It goes straight from source to native; for one thing, the source format exposes stuff that allows it to be more heavily optimized by GCC's optimizer than the bytecode format does.

    2. Re:Another weak study... by Anonymous Coward · · Score: 0

      All you say is true, however it is merely a flaw in the current GCJ implementation.

      The fact that it is possible to decompile java bytecode back into its source form with little to no changes to the structure means that any optimization that is possible with java source should be possible to a sufficiently advanced bytecode to native compiler.

    3. Re:Another weak study... by dvdeug · · Score: 2

      Context: GCJ compiles Java source better than bytecode.

      All you say is true, however it is merely a flaw in the current GCJ implementation.

      A completely optimizating compiler solves the halting problem as a side effect. Hence, any real compiler has places where it can optimize better.

      There are only so many compiler writers working on GCJ and many improvements that can made. IMO, the normal mode of GCJ is feeding your own source to it, so their time could be better spent improving the libraries and overall optimization rather then something that's more flashy than useful.

    4. Re:Another weak study... by Anonymous Coward · · Score: 0

      The reason there are no good studies of Java performance is that if you care about performance, you know not to use Java.

      The weak studies you're seeing are the result of people who only know Java trying to talk about it's performance. Java programmers generally don't know what what optimization is, and don't realize that compiled apps might not have their stupidity enhancers built in (bounds-checking, etc.) Most of them assume this is part of all languages and can't figure out why everybody's so uptight about verifying input.

      To put it simply, nobody intelligent enough to understand the issues behind a performance study care enough about Java to do one. (If you don't believe me, ask yourself why you don't just do your own study?)

      jdm

    5. Re:Another weak study... by rreyelts · · Score: 1
      It goes straight from source to native; for one thing, the source format exposes stuff that allows it to be more heavily optimized by GCC's optimizer than the bytecode format does.

      That's an interesting statement, because, in a discussion with a Sun engineer (Jeff Kesselman I believe), people were told that, concerning optimization, the point of the compiler was to produce code in a form that was optimal for the VM to optimize. I can't remember exactly where the discussion was, but I'm sure you can find it if you do a search through www.javagaming.org.

      God bless,
      -Toby

    6. Re:Another weak study... by Monkelectric · · Score: 1
      I dont know about where you live, but in the unvierse in which I reside, the halting problem has no solution. Otherwise, they woulnd't call it the halting problem, they'd call it the halting solution and there would prolly be a Turbo Halting++ program avaliable from borland.

      Halting Problem Explination>

      --

      Religion is a gateway psychosis. -- Dave Foley

    7. Re:Another weak study... by dvdeug · · Score: 2

      I dont know about where you live, but in the unvierse in which I reside, the halting problem has no solution.

      Right. Read what I said again.

      A completely optimizating compiler solves the halting problem as a side effect. Hence, any real compiler has places where it can optimize better.

      Or, more formally, a completely optimizing compiler implies a solution to the halting problem. Since there does not exist a solution to the halting problem, there does not exist a completely optimizing compiler.

    8. Re:Another weak study... by Monkelectric · · Score: 1

      in that case, I think I made an ass of myself eh? ;)

      --

      Religion is a gateway psychosis. -- Dave Foley

  28. Performance, etc. by Anonymous Coward · · Score: 0

    As I understand it, the performance gains are probably marginal. Native code compilation is not too different from JIT compilation, I would think. You do need something to do garbage collection, RTTI, etc. That doesn't go away, and is probably the majority of the performance hit.

    As a Java developer, I think this is great, and it might allow Java to be able to compete better with C#. In any case, it's certainly not a bad thing. If you want to generate classfiles, it's just an intermediate step for any native compiler, so WORA won't go away.

    And to he who made the comment wrt operator overloading -- it's a damned maintenance headache, that's why it's not included in Java.

    Taking a quick glance at the benchmarks, it looks native compilation is not all it's cracked up to be.

  29. beos developers.. by Suppafly · · Score: 2

    With the renewed interest in beos thanks to the leaked 5.1/dano release, developers for beos should seriously consider trying for a native compiler since the various jvm projects arent going anywhere fast. If beos could run java apps, I could see this renewed interest continue to grow at amazing rates..

  30. New name... by SlashChick · · Score: 2, Funny

    "...compiling Java apps to run as native appplications on the target machine without the need for a JVM."

    In other news, they have also decided on a name for this wonderful new technology: C.

    1. Re:New name... by Anonymous Coward · · Score: 0

      LOL! You have made my day!

    2. Re:New name... by FastT · · Score: 2
      they have also decided on a name for this wonderful new technology: C.
      In other news, computer scientists have developed a way to preserve all the flaws of assembly language without having to remember those pesky 3-letter pneumonics. They have also decided on a name for this wonderful new technology: C.
      --

      The only certainty is entropy.
    3. Re:New name... by Anonymous Coward · · Score: 0

      Hmm, I understand you are running your new, shiny OS written in (all praise Sun) Java.

      Are you ?

    4. Re:New name... by FastT · · Score: 2

      At last we agree. I'd no more use Java to write an OS than I'd use C to write a real-world application.

      --

      The only certainty is entropy.
    5. Re:New name... by Anonymous Coward · · Score: 0

      Heh, to those of us who know high level languages, all your little C derived languages look like portable assembly. Java is just portable assembly that runs on a machine that doesn't exist.

  31. VM: a definition by fm6 · · Score: 5, Informative
    In a previous life, I sat in a corner taking notes while around me, engineers designed Java VMs. The experience didn't make me into a real expert, but it did make one thing clear: there's no such thing as running Java without a VM.

    People think of the VM as an interpreter that executes the bytecodes. That's a particular implementation of a VM. And not a very good one -- which is why no production VM works that way.

    The simplest optimization is to use a JIT. This gives you native execution speed once the class files are loaded -- but loading is slower, because it includes compiling the byte codes. You can end up wasting a lot of time compiling code you'll only execute once -- most programs spend 90% of their time in 10% of their code. Depending on the application, you can end up wasting more time on unnecessary compilation than you save by running native code.

    Intuition suggests that the most efficient thing to do is to "get rid" of the VM by compiling everything to native code before you distribute your app. But that doesn't get rid of the VM -- it just converts it to a different form. There are some VM features you can't compile away, such as garbage collection. Some experts claim (not me, I get dizzy when I even read benchmarks) that "pure" nativeness is illusory and not that efficient. Plus you lose a lot of the features of the Java platform when you run the program that way. Might as well stick with C++.

    Some VM implementations use a sophisticated comprimize between interpreters and JIT compilers. If you can identify the small part of the program that does most of the actual work, you know what parts of the program really need to be compiled. How do you do this? You wait until the program actually starts running!

    Advocates of this approach claim that it has the potential to be faster than C++ and other native-code languages. A traditional optimizing compiler can only make decisions based on general predictions as to how the program will behave at run time. But if you watch the program's behavior, you have specific knowledge of what needs to be optimized.

    Computer science breakthrough, or illogical fantasy? Don't ask me, I'm just a spectator.

    The engineers I picked this stuff up were very contemptuous of "microbenchmarks" like those described in the developerWorks article. Nothing to do with the real world.

    1. Re:VM: a definition by Anonymous Coward · · Score: 0

      How does it feel to type all that useless crap knowing that nobody will read it, it contributes nothing to the general discussion, and only serves as a karma whore?

      Ass-spleunking faghole.

    2. Re:VM: a definition by slashdot2.2sucks · · Score: 1
      Advocates of this approach claim that it has the potential to be faster than C++ and other native-code languages. A traditional optimizing compiler can only make decisions based on general predictions as to how the program will behave at run time. But if you watch the program's behavior, you have specific knowledge of what needs to be optimized.


      That is what profilers are for. And if some Java VM could build a profiler into the interpreter/compiler then there is nothing to stop a profiler from being built into a C/C++ compiler.

    3. Re:VM: a definition by fm6 · · Score: 2

      Not the most imaginative troll.

    4. Re:VM: a definition by spiral · · Score: 2

      > ...there is nothing to stop a profiler from being built into a C/C++ compiler.

      While profile-driven optimizing compiler are interesting, I think you're missing the point here. With a profiling JIT, the information is gathered and used at runtime, not compile time. That means that you're optimizing for THIS run, not some run that you hoped was representative at development time.

      For a bogus benchmark, the two approaches are effectively identical -- each benchmark run presumably runs exactly the same code as the last. The compile-time profiler would win simply because it doesn't add any runtime overhead. In an interactive application, say GUI or a game, you can't really predict what functionality any particular user will stress.

      Of course, for added fun, the two approaches don't have to be mutually exclusive. There's no reason you can't find and improve many of your code's hot spots at development time, and then let the JIT do its thing at runtime.

      --
      Drinking will help us plan!
    5. Re:VM: a definition by scrytch · · Score: 2

      Intuition suggests that the most efficient thing to do is to "get rid" of the VM by compiling everything to native code before you distribute your app. But that doesn't get rid of the VM -- it just converts it to a different form. There are some VM features you can't compile away, such as garbage collection.

      Where did you pull this assertion out? It's rubbish. Eiffel and Ada are garbage collected out of the box. C and C++ can be by just linking code to a different library. The 'V' in VM stands for Virtual. There is no virtual machine being used, it is using the real machine. Real registers, real opcodes. In fact, gcj compiles down to what amounts to C++ (the object layout is the same)

      Some experts claim (not me, I get dizzy when I even read benchmarks) that "pure" nativeness is illusory and not that efficient. Plus you lose a lot of the features of the Java platform when you run the program that way.

      Partly true on both counts. A VM has some known constraints that lends utsekf to optimization. Pointers in C and C++ for example create potential aliasing problems that just don't exist in Java. However, a good native compiler (not a merely adequate one like gcc) can do instruction ordering that a VM cannot. Bytecode has advantages like portability, and with clever classloaders, you can do all kinds of wizardry to objects by rewriting the bytecode. Not every app needs these features however, and so native compilation is also a compelling option. Native compilation also gains you the capability of using more native features efficiently. Case in point, JNI is slow -- Macromedia Generator is largely a Java scaffold around C++ components, so it uses JNI extensively. Turns out to be slower than an alternative written in pure java.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    6. Re:VM: a definition by dvdeug · · Score: 1

      Eiffel and Ada are garbage collected out of the box.

      Eiffel, yes. Ada is designed so it can easily be garbage collected, but no one supports it in practice unless you're compiling to the Java VM.

    7. Re:VM: a definition by AtrN · · Score: 2

      While I agree with "Where did you pull this assertion out?" the follow up doesn't go far enough. People are forgetting that languages have models of data and regardless of translator and execution style you need to implement the language's data model. For Java this means objects with GC. VM or real-M.

    8. Re:VM: a definition by cornflux · · Score: 1

      really! if no one reads what you wrote, are you still a karma whore? (did the tree fall?)

      I, for one, found your post interesting.

    9. Re:VM: a definition by fm6 · · Score: 2

      You read it. Your jealousy is almost tangible!

    10. Re:VM: a definition by cornflux · · Score: 1
      You read it. Your jealousy is almost tangible!
      I think you misunderstand me. Did I lose you somewhere? Let me explain.

      I agreed with your comment about the troll. I even said I enjoyed your comment. (Did you miss that?)

      The troll implied that you were being a karma whore. But, they also said that no one would read your comment.

      My point was: if no one reads your commment how can you be a karma whore? (i.e., if no one reads your comment, how can your comment be moderated? and, then, how can you benefit karma-wise from a comment that is not moderated?)

      You know... I was attempting to support you, but I really just shouldn't have bothered.

    11. Re:VM: a definition by fm6 · · Score: 2

      Hey, don't be so sensitive. It's not your fault I'm slow.

  32. Re:So this article is posted? Why not mine? by Anonymous Coward · · Score: 0

    Actually, the first gives 111 and the second 795.

  33. The article misses some key points by kaladorn · · Score: 5, Informative

    First, I have to identify that we (my company) do use the JET byte->native compiler by Excelsior. Good product, I've recommended it to others and they've had success with it too. In our case, it produced a 10-15% speed increase, some in-memory size savings, and it had one huge advantage missing from the byte code: SECURITY!

    After experimentation, I'm pretty convinced that the decompilers on the market that work on obfuscated byte code KICK THE CRAP OUT OF THE OBFUSCATORS. The long and the short of it is the decompiled code is pretty decipherable.

    If you want to protect your IP (Intellectual Property), that's not a good thing. In fact, that might be (if you are in a competitive arena) a VeryBadThing(TM). The native code (especially optimized native code) is far harder to effectively decompile into something usefully readable which crackers and script kiddies can abuse or which competitors can peruse. This benefit alone makes it worth going this route if you can.

    One of the other things the article missed:
    It didn't devote much thought to the settings and optimizations these compilers provide. The Excelsior compiler (by example, I looked at Bullet Train and some others before we picked Excelsior) provides ways to disable certain safety checks (like array bounds checks) for extra speed. If you're in a fairly aggressive environment with some pretty significant timing issues (I won't say hard realtime, because anyone doing hard realtime should be using something like QNX), you will find that even these small gains may be useful (and the risks they introduce acceptible). But the article didn't even hint at these possibilities.

    So, if you want to build something that is less likely to be cracked or examined, this type of tool is the way to go. Excelsior, for example, is fairly easy to setup. I did get some help from their guys, but only because our product includes OpenGL, QuickTime, a bunch of XML parser stuff, DirectX, sound support, UI, etc. - a whole pile of external dependencies. The buddy I recommended it to had his project up in going in half an hour or so, with a more modest project (but still a useful, full fledged app with GUI).

    Undoubtedly, these won't solve all your ills and they may introduce some new difficulties in bug hunting (though some of the new debuggers coming out with these products are very neat also). So you will want to look at what you need, what your concerns are (security, speed, cross platform deployment, etc) and decide accordingly.

    --
    -- Mal: "Well they tell you: never hit a man with a closed fist. But it is, on occasion, hilarious."
    1. Re:The article misses some key points by _xeno_ · · Score: 3, Interesting
      After experimentation, I'm pretty convinced that the decompilers on the market that work on obfuscated byte code KICK THE CRAP OUT OF THE OBFUSCATORS. The long and the short of it is the decompiled code is pretty decipherable.

      That's probably because there's really no way to obfuscate Java byte code, since it's all java.lang.reflectable anyway - you can use Java code to dynamically load a class name at run time and then discover methods it contains and public variables it has.

      As far as I know the .class format in essense requires methods and class variables to be determinable makes it fairly hard for Java to be "secure" when it comes to making code hard to disassemble. Especially because all your classes wind up being one-class-to-file and by default end up with the names of the classes and the package structure laid out in the directories created...

      Sun may want to consider creating a secure JAR file which is loaded by a "secure" class loader that prevents reflecting, but a lot of cool stuff can be done with the reflect interface (like loading plugin classes at runtime).

      Bottom line is that every .class file contains a list of all methods and public variables as well as being one instance of an original class definition - not useful for making your program structure hard to dissassemble. However, the ability to determine methods and load classes at runtime can be useful to. (As well as required for Java's RMI, I think - I might be wrong, though.)

      --
      You are in a maze of twisty little relative jumps, all alike.
    2. Re:The article misses some key points by LadyLucky · · Score: 2, Interesting
      KICK THE CRAP OUT OF THE OBFUSCATORS.

      This is not the case anymore. An example is Zelix Klassmaster. We use it for our java web application. No decompiler can cope with it. The decompiled code is littered with byte code that it couldnt work out what to do with. I wrote the code, and I cannot for the life of me work out which methods are which in the decompiled after obfuscated classes. They also do things like String encryption so even string constants are unrecognisable.

      Java is certainly not perfect in this respect, but my experience with obfuscation (this is very recent) has been very good.

      --
      dominionrd.blogspot.com - Restaurants on
    3. Re:The article misses some key points by danonb · · Score: 1

      So I tried Jet-Excelsior today. It worked for me! But it didn't work when I copyied the .exe to another machine. What's the use when I have to drag these huge .dll's around? I might as well just install the jre on the other machine.

    4. Re:The article misses some key points by (H)elix1 · · Score: 2


      After experimentation, I'm pretty convinced that the decompilers on the market that work on obfuscated byte code KICK THE CRAP OUT OF THE OBFUSCATORS. The long and the short of it is the decompiled code is pretty decipherable.


      Oh man, you are not kidding. One department at the shop I work at holds their source code very close to their chest. It is easier to JAD the class files into java code than it is to go through channels to get a copy of the source. Try it - even on big commercial code like an app server. You will be shocked.

    5. Re:The article misses some key points by Anonymous Coward · · Score: 0

      "Sun may want to consider creating a secure JAR file"

      Wouldn't help at all. Removing the ability to use the built in reflection to read the info would only keep out unsophisticated java programmers. Everyone else would simply parse the .class files themselves and extract the info.

    6. Re:The article misses some key points by Anonymous Coward · · Score: 0

      Did you seriously mention in one and unique post security *and* the "acceptible" risk of disabling array boundary checks. So while C/C++ programmers are busy doing things right and patching those buffer overflows, equally abysmal java coders disable security (as opposed to IP protection) features they had for free and introduce new ones! The script kiddies must love it!

    7. Re:The article misses some key points by rreyelts · · Score: 1
      That's probably because there's really no way to obfuscate Java byte code, since it's all java.lang.reflectable anyway - you can use Java code to dynamically load a class name at run time and then discover methods it contains and public variables it has.

      I think you're missing part of the point of an obfuscator. Most obfuscators turn meaningful class and method names like "FourierTransform" and "calculateNow" to "A_" and "b_". So programs end up looking like this:

      A_.b_( c_, x1_, y2_ );

      Of course, obfuscators can't perform this name mangling on API's which are meant to be exposed publicly.

      Sun may want to consider creating a secure JAR file which is loaded by a "secure" class loader...

      I once upon a time built a class loader in C++ to protect the "IP investment" for a product. It would verify the product license, and then load the product's encrypted classes from disk, into the virtual machine. Of course, people can't compile against encrypted classes, so I had to write a program which would read the product's class files and generate a library of "stub classes" which our SDK users could compile against.

      Bottom line is that every .class file contains a list of all methods and public variables as well as being one instance of an original class definition - not useful for making your program structure hard to dissassemble.

      Strangely enough, Microsoft's CLR has the exact same problems, but amazingly, nobody is whining and complaining about it.

      Frankly, people don't seem to understand that "native compilation" is no magic bullet. If the processor understands the code, so can a human. And if you've ever spent some serious time designing hardware or programming assembly for a microcontroller or a processor, you know how easy it really is to decipher assembly.

      God bless,
      -Toby

    8. Re:The article misses some key points by _xeno_ · · Score: 1
      I think you're missing part of the point of an obfuscator. Most obfuscators turn meaningful class and method names like "FourierTransform" and "calculateNow" to "A_" and "b_".

      Actually, I know how they work. However, with most native compiled language, you don't even get clearly defined function statements, except for CALL address or the equivilent - argument lists and types are much harder to determine and reverse compiling becomes much, much harder.

      Since a Java .class file clearly delinates all methods, what type they return and what type of arguments they take, it becomes harder to obfuscate the inner code workings. Yeah, something like a method called byte[] decryptStream(InputStream in) may be rendered as byte[] a214__2(InputStream arg1) by an obfuscator - but you still have a very clear definition of what it takes - although it may take some working to determine what exactly it does.

      Still, as any maintance programmer can tell you, it's possible to figure out exactly how a program works without meaningful variable names and without comments - it just might be harder. (I remember the guy who named all his variables countn, where n was from 1 to however many variables he needed - count1 could be the iterator and count2 may have been the initial value - in other cases, this was reversed...)

      Bottom line is that when the structure of a program is still clearly marked out in the .class format, it becomes easier to reverse assemble and the obfuscators don't really help much - they just make the task of reverse engineering the product that much more difficult - but the structure is still there.

      I once upon a time built a class loader in C++ to protect the "IP investment" for a product. It would verify the product license, and then load the product's encrypted classes from disk, into the virtual machine.

      This really isn't in response to you, but to the other AC reply: When I said that Sun should create a "secure" JAR classloader, that's actually kind of what I meant - the classes should be encrypted. I'm not sure if it's possible to make reflect fail on loaded classes - it may be necessary for the runtime link step - but that would be the next step to create a "secure" classloader.

      --
      You are in a maze of twisty little relative jumps, all alike.
    9. Re:The article misses some key points by Anonymous Coward · · Score: 0

      But the VM needs to decrypt the classes, which means it must have the decryption key, which means that with enough effort, someone can go into the VM and find the key and write a decryption application and post it to the web. (Anonymously, so they don't get DMCA'd.) Not worth the effort to implement this in the VM, if it's eventually going to get broken anyway.

      In general this kind of thing - letting a computer access some info, but not a person - is impossible. The only way to do it is by having the decryption work in hardware *only*. And that only works if the hardware is secure enough to resist all hacking attempts (assuming that someone is sufficiently motivated to try to hack it).

    10. Re:The article misses some key points by kaladorn · · Score: 2

      Huge .dlls? I didn't find the JET embedded JVM to be terribly huge. Of course, our app runs at somewhere between 30 and 60 Mb of memory usage and disk space waaaay beyond that. So I wasn't looking at it for size as a primary concern. The in-memory footprint was smaller than when running the HotSpot VM. The disk space hit just doesn't seem like an issue anymore. But, YMMV. :)

      --
      -- Mal: "Well they tell you: never hit a man with a closed fist. But it is, on occasion, hilarious."
    11. Re:The article misses some key points by kaladorn · · Score: 2

      Yes, I did. You'll note my principal security focus was on the INTELLECTUAL PROPERTY issue, not run-time security. They are very different considerations. Codebase security and system integrity are both valid concerns, but different.

      You'll also note I did not _recommend_ disabling run-time bounds checking, I just pointed out that it is an option if you absolutely NEED THE SPEED. Obviously, you'd have to decide if you were willing to undertake the inherent risks in disabling this kind of check. In some cases, this may be necessary. (Though again, why you'd be using Java in these circumstances is a question - writing MMORPG technology isn't hard real-time though there are serious performance benchmarks).

      BTW, disabling run-time bounds checking on all-arrays does not mean you don't have any security. It just removes the "father knows best" work in the JVM and the compiler into the hands of the programmer. One can still be careful with how one accesses strings (for example using some secure string classes). One does not NEED to have the system do the work for him or her. And there may be times you need every processor cycle. If having the system run-time check array bounds is expensive enough to cause a critical failure in my system, and I can't sell it, then it really doesn't matter how secure it is.

      Also, I'd like to point out that using strncpy() in C and a number of other sensible precautions have existed for years, and C/C++ programmers still _routinely_ don't bother.

      There are two ways to have security: Have the OS do it for you (Do you enjoy the sandbox? Works well, can't do much in it!) or having conscientious and well-trained programmers. Since there hasn't been much emphasis on security in programming courses at Colleges, Universities and trade schools, this lack of attention is scarcely surprising. But is the solution better educated programmers or paternalistic tools? I know which I'd choose, just in case the tool isn't designed to handle something a well educated programmer might catch.

      And BTW, I made an exception this once to talk to an AC. You were motivated enough to comment, so I assume laziness isn't the shortcoming. So I'll have to assume you don't like to stand up for things you say....

      --
      -- Mal: "Well they tell you: never hit a man with a closed fist. But it is, on occasion, hilarious."
  34. Re:Question for trolls by SweetAndSourJesus · · Score: 0, Troll

    eat my ass, fuckmonkey. the trolls are the only reason i come to this site.

    browse at 0.

    thank you.

    --

    --
    the strongest word is still the word "free"
  35. Java's Cover by Anonymous Coward · · Score: 0, Troll

    The aphorism "you can't tell a book by its cover" originated in the times when books were sold in plain cardboard covers, to be bound by each purchaser according to his own taste. In those days, you couldn't tell a book by its cover. But publishing has advanced since then: present-day publishers work hard to make the cover something you can tell a book by.

    I spend a lot of time in bookshops and I feel as if I have by now learned to understand everything publishers mean to tell me about a book, and perhaps a bit more. The time I haven't spent in bookshops I've spent mostly in front of computers, and I feel as if I've learned, to some degree, to judge technology by its cover as well. It may be just luck, but I've saved myself from a few technologies that turned out to be real stinkers.

    So far, Java seems like a stinker to me. I've never written a Java program, never more than glanced over reference books about it, but I have a hunch that it won't be a very successful language. I may turn out to be mistaken; making predictions about technology is a dangerous business. But for what it's worth, as a sort of time capsule, here's why I don't like the look of Java:

    1. It has been so energetically hyped. Real standards don't have to be promoted. No one had to promote C, or Unix, or HTML. A real standard tends to be already established by the time most people hear about it. On the hacker radar screen, Perl is as big as Java, or bigger, just on the strength of its own merits.

    2. It's aimed low. In the original Java white paper, Gosling explicitly says Java was designed not to be too difficult for programmers used to C. It was designed to be another C++: C plus a few ideas taken from more advanced languages. Like the creators of sitcoms or junk food or package tours, Java's designers were consciously designing a product for people not as smart as them. Historically, languages designed for other people to use have been bad: Cobol, PL/I, Pascal, Ada, C++. The good languages have been those that were designed for their own creators: C, Perl, Smalltalk, Lisp.

    3. It has ulterior motives. Someone once said that the world would be a better place if people only wrote books because they had something to say, rather than because they wanted to write a book. Likewise, the reason we hear about Java all the time is not because it has something to say about programming languages. We hear about Java as part of a plan by Sun to undermine Microsoft.

    4. No one loves it. C, Perl, Python, Smalltalk, and Lisp programmers love their languages. I've never heard anyone say that they loved Java.

    5. People are forced to use it. A lot of the people I know using Java are using it because they feel they have to. Either it's something they felt they had to do to get funded, or something they thought customers would want, or something they were told to do by management. These are smart people; if the technology was good, they'd have used it voluntarily.

    6. It has too many cooks. The best programming languages have been developed by small groups. Java seems to be run by a committee. If it turns out to be a good language, it will be the first time in history that a committee has designed a good language.

    7. It's bureaucratic. From what little I know about Java, there seem to be a lot of protocols for doing things. Really good languages aren't like that. They let you do what you want and get out of the way.

    8. It's pseudo-hip. Sun now pretends that Java is a grassroots, open-source language effort like Perl or Python. This one just happens to be controlled by a giant company. So the language is likely to have the same drab clunkiness as anything else that comes out of a big company.

    9. It's designed for large organizations. Large organizations have different aims from hackers. They want languages that are (believed to be) suitable for use by large teams of mediocre programmers-- languages with features that, like the speed limiters in U-Haul trucks, prevent fools from doing too much damage. Hackers don't like a language that talks down to them. Hackers just want power. Historically, languages designed for large organizations (PL/I, Ada) have lost, while hacker languages (C, Perl) have won. The reason: today's teenage hacker is tomorrow's CTO.

    10. The wrong people like it. The programmers I admire most are not, on the whole, captivated by Java. Who does like Java? Suits, who don't know one language from another, but know that they keep hearing about Java in the press; programmers at big companies, who are amazed to find that there is something even better than C++; and plug-and-chug undergrads, who are ready to like anything that might get them a job (will this be on the test?). These people's opinions change with every wind.

    11. Its daddy is in a pinch. Sun's business model is being undermined on two fronts. Cheap Intel processors, of the same type used in desktop machines, are now more than fast enough for servers. And FreeBSD seems to be at least as good an OS for servers as Solaris. Sun's advertising implies that you need Sun servers for industrial strength applications. If this were true, Yahoo would be first in line to buy Suns; but when I worked there, the servers were all Intel boxes running FreeBSD. This bodes ill for Sun's future. If Sun runs into trouble, they could drag Java down with them.

    12. The DoD likes it. The Defense Department is encouraging developers to use Java. This seems to me the most damning sign of all. The Defense Department does a fine (though expensive) job of defending the country, but they love plans and procedures and protocols. Their culture is the opposite of hacker culture; on questions of software they will tend to bet wrong. The last time the DoD really liked a programming language, it was Ada.

    Bear in mind, this is not a critique of Java, but a critique of its cover. I don't know Java well enough to like it or dislike it. This is just an explanation of why I don't find that I'm eager to learn it.

    It may seem cavalier to dismiss a language before you've even tried writing programs in it. But this is something all programmers have to do. There are too many technologies out there to learn them all. You have to learn to judge by outward signs which will be worth your time. I have likewise cavalierly dismissed Cobol, Ada, Visual Basic, the IBM AS400, VRML, ISO 9000, the SET protocol, VMS, Novell Netware, and CORBA, among others. They just smelled wrong.

    It could be that in Java's case I'm mistaken. It could be that a language promoted by one big company to undermine another, designed by a committee for a "mainstream" audience, hyped to the skies, and beloved of the DoD, happens nonetheless to be a clean, beautiful, powerful language that I would love programming in. It could be, but it seems very unlikely.

    by Paul Graham

    1. Re:Java's Cover by Incon · · Score: 1

      I love Java. Whoops, there goes No. 4!

    2. Re:Java's Cover by LabRatty · · Score: 1

      Nice troll. Completely devoid of fact or evidence and you still fill a page. 10/10.

      ratty

    3. Re:Java's Cover by Anonymous Coward · · Score: 0

      Then you should go learn a REAL language.

    4. Re:Java's Cover by Anonymous Coward · · Score: 0

      it's not his work, it's Paul Graham's, and by the way, the man knows what he's talking about.

    5. Re:Java's Cover by Incon · · Score: 1

      I would but pointers scare me.

      Pointers bring droughts to farmers and carry off your daughters!

    6. Re:Java's Cover by Anonymous Coward · · Score: 0

      uh, well ok then, just stick to VB/C#/Java then. And stay a weak and mediocre programmer.

    7. Re:Java's Cover by gUmbi · · Score: 1

      I think you're missing something. The one big thing about Java that differentiates it from languages such as C++ is that it is as much as language as an API.

      Languages don't really make you more productive. Sure, one Fortran is good for numbers, Assembly is great for performance but they both lack an API as consistent and productive as the Java API.

      Programmers building applications for business (web servers, database front end, app servers, etc.) love the idea that we can use a great language and someone (Sun) is going to help define standards, deliver workable (and free) parts and support developers.

      The best comparison is Visual Basic. As a language it stinks. As a development environment it rocks. Delphi is a bit better on the language part and Java nailed both.

      I've never found a language that allowed me to be as productive as Java for the type of applications that I build. The language supports all the things I need such as threads, network communication (RMI) and web development (JSP) and the API allows me to develop apps quickly and with the freedom of interchanging parts (Web servers, databases, etc.) from different vendors whenever I want.

      Jason.

    8. Re:Java's Cover by borzwazie · · Score: 2
      Having worked for the Gov't I think I can tell you why the DoD loves it's plans and protocols so much, as you put it:


      If your programming mucks up, the wrong people DIE. If you don't have standards that are _rigorously_ abided by, our soldiers DIE. The US military and the rest of the gov't prides itself on it's technological edge. It relies on on structures that are there NOT to screw up (ask a space shuttle computer programmer about standards sometime).


      At the risk of responding to a troll, I'd like to point out to the parent's moderators that there's a reason for "bureaucratic" programming.


      Probably the reason the DoD likes Java (if they do, I don't know for sure) is that it's well documented, has a wealth of libraries, and reasonably safe (secure) out of the box, even in the hands of someone relatively inexperienced with secure coding standards.


      To get back on topic, I've tried native compilation of Java code...I'm not really sold on it. On higher-end machines, or machines with goodly amounts of ram, Java's no stinker. The upcoming 1.4 from Sun promises neat stuff like 2D acceleration. No 2D accel is one of the reasons why redraws feel relatively slow now. Plus, speeds of JIT's are increasing to the point at which I'm not sure I'd want to give up platform independence. If anything, this is probably useful to the handheld crowd, more than any other platform.

      --

      "We apologize for the inconvenience."

    9. Re:Java's Cover by zentec · · Score: 1


      I used to have the same beliefs about Java, and I authored quite a bit of software with it. I thought it was klunky, slow and you had to kludge your way through it to get it to work exactly as you wanted. The platform independence seemed mythical, despite all the anecdotal success stories from Sun and Java's creators.

      That has changed somewhat. My enterprise backup system uses Java as the administration interface, and it's fairly snappy across Windows and Unix. It still suffers from inconsistencies between platforms, it's still painfully slow in certain functions, but it's come a long way since I programmed in it.

    10. Re:Java's Cover by _xeno_ · · Score: 2, Flamebait
      It's still a useless bit of fluff - based on observations about the language and not projects that are actually using it.

      Small list of open-source Java projects:

      • Jakarta - the Apache Software Foundation's primary Java development site. Most notable are their Tomcat and Ant projects.
      • Xerces - a pure-Java XML parser (there's a C++ version too) - also by the Apache Software Foundation.
      • jEdit - pure Java text editor. Very powerful and easily extensible with Java plugins.
      • Over 4000 projects at SourceForge.
      • Freenet - the idea behind the network has gotten a lot of publicity, it's client is written in Java.

      There's quite a community based around Java - I would suggest people start looking at those aspects of its cover.

      --
      You are in a maze of twisty little relative jumps, all alike.
    11. Re:Java's Cover by lgraba · · Score: 1

      Thank you for your uninformed opinion.

      Seriously, you tell us you've never used it, but you don't like the look of it? How useful is that?

    12. Re:Java's Cover by rusti999 · · Score: 1

      This comment can also be viewed here.

    13. Re:Java's Cover by javaXP · · Score: 1

      I wonder what kind of book you get by just looking at the cover.
      Some people never learn :)
      Yesterday's cover was nice as well.
      Tomorrow's cover will probably be nicer than today's.
      If you are a real hacker, you are going to learn everything you can.
      Knowledge still is power ! :-)

    14. Re:Java's Cover by coldtone · · Score: 1

      I find that java is either loved or hated.

      I think a lot of people hate java because it makes the feel obsolete. In C & C++ you have to do almost everything from scratch. (Manually check array lengths, clean up your memory, build your own utilities classes and functions.) And at the end of the day when the app is done you can say that it is 100% yours. Every machine instruction being executed it yours. This instills a lot of pride in the person who wrote it.

      Also C and C++ is cryptic. It's made to be hard to read. It's made to save keystrokes. Again this makes the programmer feel good. Only great programmers can read hit code. Ha!

      Java on the other hand has a ton of stuff done for you already. All sorts of goodies built in to every version. And they are available wherever you go! This lets me build more complex applications faster.

      Why is Java hyped? Bias, the developers of Java knew that the Hacker culture would reject it because it takes away their security. (Code is easy to read, Time isn't spent building low level classes, easy for someone to pickup where someone else left off. Easy to refractor.) They need to yell louder then the grumbling in the C, C++ community.

      Why does business like it? Because they are sick and tired of dealing with cocky programmers who can hold them hostage. Everyone knows a good C, C++ programmer is hard to find. Java takes away a lot of this power, because it's easy to read and learn.

      So the last refuge of the C, C++ programmer is speed. They can say there app is slightly faster then Java apps. With computers getting faster every day, this becomes less and less of an argument.

    15. Re:Java's Cover by Anonymous Coward · · Score: 0

      Nice troll. I have seen the work of people who find Java easy to program. If you are dumb, you are dumb; nothing can and will change it. Moron

    16. Re:Java's Cover by Anonymous Coward · · Score: 0

      Ok. I'll pretend your not a troll, and respond point by point:

      1. Real standards don't have to be promoted? So there's no hype surrounding HTML or Unix?

      2. Historically, languages designed for other people to use have been bad? I know... COBOL, C++, Visual Basic... all flops.

      3. I'm not touching number three. That one came from under a bridge.

      4. I love Java. I have yet to meet anyone who has used it for more than a few weeks and didn't like it. I go to meetings with others who love Java (http://www.ociweb/javasig/). 100 people at a time talking about our favorite language. Only one or two wear suits.

      5. I know people who have left their jobs because the companies wouldn't use Java. I work with several now who did the same.

      6. Too many Cooks is a real problem. Java was written by a small group. The APIs are controlled by a very large group. That would be a problem, except only small groups of people work on each problem. Everyone else can only watch (and send an email). Checkout the JCP for more information.

      7. I have no idea what your talking about on this one.

      8. Yes, Perl and Python are cool. So is Java. So what? Java has a very big API set. You can do a lot more with Java than with Perl or Python (not a knock on those languages; Java is just has a very wide audience).

      9. So Java isn't popular with low-level coders... Agreed. It must be a failure.

      10. eh? see #3

      11. if #11 makes sense to anyone, please post.

      12. now your just kidding... right?

      Sorry. I tried to take it seriously. But by the time I got to the end, I realized I'm just feeding a troll.

    17. Re:Java's Cover by mrpotato · · Score: 1

      Don't worry, you are not really responding to a troll here, and I think you make sense a lot.

      Java is good for the fact that, as you say, it is well documented, clean and secure.

      But the post here (which is a rant by Paul Graham) is somewhat taken out of context. Paul Graham dislikes Java, but it is because he is a Lisp hacker. Really, he is very good at what he is doing. He is working on a new language too (Arc) which looks very promising.

      Paul is used to have a very, very flexible language in his hands that allows him to speak freely to a computer, while Java is more of a rigourous and "straight" language. It does have all the strengths it pretends to have (security, efficiency, portability...) but it lacks some expressivity that you can get in Lisp.

      I guess it is a question of audience...

      --

      cheers
    18. Re:Java's Cover by Anonymous Coward · · Score: 0

      You can use pointers in C#, dipshit.

    19. Re:Java's Cover by Waffle+Iron · · Score: 3, Insightful
      I've never found a language that allowed me to be as productive as Java for the type of applications that I build. The language supports all the things I need such as threads, network communication (RMI) and web development (JSP) and the API allows me to develop apps quickly and with the freedom of interchanging parts (Web servers, databases, etc.) from different vendors whenever I want.

      I agree with you relative to C/C++, and I was using Java heavily a couple of years ago. But now I've moved on to higher-level languages such as Perl, Python and Ruby. They each have APIs that provide functionality similar to Java, but usually simpler and more intuitive. They also don't have licensing policies or agendas driven by one particular corporation..

      I usually get the same job done with 1/2 or 1/3 the lines of code as with Java. I've also found that once you free your mind from the strong-typing yoke, you can transform your concepts into reality much more efficiently.

      It's funny that a few years ago I had to argue to the PHBs that Java was a valid solution. Now, they are set on Java, and I have to argue that a better solution has emerged as support for other languages has matured.

    20. Re:Java's Cover by persaud · · Score: 1

      More open-source Java projects at javaindex.org.

      Rich

    21. Re:Java's Cover by Sivar · · Score: 1

      You would...Love Java, but poiters scare you?
      Be brave, young Incon, for Java has no pointers!

      --
      Computer Science is no more about computers than astronomy is about telescopes. --E. W. Dijkstra
    22. Re:Java's Cover by jo42 · · Score: 1

      Yes, but where are the word processors, spreadsheets, databases, operating systems and real world applications (i.e. PhotoShop, Quark, Maya), etc. written in Java. Hmm?

    23. Re:Java's Cover by FastT · · Score: 3, Insightful
      I think a lot of people hate java because it makes the feel obsolete
      I agree. If twisting your brain to think like a silicon chip that is less intelligent than your average paramecium is your yardstick of personal greatness, so be it. It's not mine. I'd rather spend my time defining the architecture to solve the problem at hand than spend a few months writing the infrastructure to support that architecture. I'd rather let an expert on linked lists write the most efficient linked list possible, and just let me inherit from it.

      Why does business like it?
      For what you said, and so much more. In the end, Java reduces resource costs. It lets them choose their platform, and not be hamstrung because of that decision down the road. It lets them escape vendor lockin. It lets them vastly reduce their support costs. And many other reasons that I'm just too tired to list.
      So the last refuge of the C, C++ programmer is speed. They can say there app is slightly faster then Java apps. With computers getting faster every day, this becomes less and less of an argument.
      And besides, hardware is cheap, at least to a company. It's cheaper to buy many times more hardware to support a more maintainable application than it is to try to cut hardware costs by spending an arm and a leg developing the fastest, most efficient software. Not only do they risk not doing that (it's like a 10% shot that they can even do it), but the lifetime of hardware is much shorter than that of software, and it tends to be a fixed cost, unlike problems with software.
      --

      The only certainty is entropy.
    24. Re:Java's Cover by Andreas+Rueckert · · Score: 1

      Would you mind to add ArgoUML to your list? Losts of nice folks using Java voluntarily for a big Opensource project. Uses AWT, Swing, etc. and is actually usable! (No, not too slow).

    25. Re:Java's Cover by Anonymous Coward · · Score: 0

      This is a 50 years war. That's how long management have been trying to deskill the software development profession. Historically, management (and the tools they use to attempt this ) have always lost, largely because writing software has always been a task for the highly intelligent and highly skilled and that hasn't changed in those 50 years and won't for the foreseeable future. In the historical perspective, those tools that are used in this deskilling war tend to have brief (c. 5-10 years) flashes of popularity and then disappear without trace, as management discovers they still need to employ people who are brighter than they are to write good software. I expect Java to disappear the same way.

    26. Re:Java's Cover by Anonymous Coward · · Score: 0

      This is debatable. Java has references, but I think this is more of a marketing term. Pointers sounds dangerous.

      I mean, you can still have objects pointing to each other. they can be re-referenced.

    27. Re:Java's Cover by iapetus · · Score: 2
      So far, Java seems like a stinker to me. I've never written a Java program, never more than glanced over reference books about it, but I have a hunch that it won't be a very successful language.

      I didn't bother reading your discussion of why you don't think Java will be a very successful language (too late, by the way - it already is), but I have a hunch that all of your points were invalid.

      --
      ++ Say to Elrond "Hello.".
      Elrond says "No.". Elrond gives you some lunch.
    28. Re:Java's Cover by bugbear · · Score: 1

      Though I did write this, I didn't post it here, and would not have. I wrote this to figure out for myself why Java seemed suspicious. Posting it on a forum like slashdot amounts to a troll.

      I think this sort of article is barely worth writing (if something does suck, time will take care of it), and that's why on the site I put it near the bottom.

    29. Re:Java's Cover by Anonymous Coward · · Score: 0

      How can this guy not be rated TROLL!!!

      My friend, you admit you have not built anything using java. That right there discredits you.

      Much of what you have posted here as "fact" is entirely wrong. Prime example: Java WAS developed by a small team. The JCP really has little bearing on the LANGUAGE, rather on non-language extensions instead.

      I think almost every point you make here could be countered, but I won't waste my time - I have bills to pay, and Java does that quite nicely.

      I will leave you with this thought though: Why did you bother posting this? What you have written comes across as extremely amature. I would guess that you have not worked as a professional software engineer, because your comments are not those of someone who is working in that field. In other words, your comments are petty observations from an outsider. It is ok to not like java, but at least get your facts straight and base your opinion on something worthwhile.

      And for the love of anything, will somebody shoot the ignorant moderators that allowed this troll to get +1 interesting!

    30. Re:Java's Cover by Anonymous Coward · · Score: 0

      "I think a lot of people hate java because it makes them[sic] feel obsolete"

      Bingo.

    31. Re:Java's Cover by Bodrius · · Score: 2

      I disagree with your conclusion, but I find your comments most insightful. Particularly because you admit to be judging Java by its cover, and the reality is that the worst part of Java, IMHO, is its cover. It has little to do with the language strengths, and promotes a lot of its weaknesses (applets, anyone?).

      Let me try to address each argument. Note that these rebuttals are based on my limited experience and the impression I get from the language, and I'm no expert:

      1. It has been so energetically hyped. Real standards don't have to be promoted... . On the hacker radar screen, Perl is as big as Java, or bigger, just on the strength of its own merits.

      Java is not a "hacker"'s programming language, it's a software designer's programming language. A lot of what makes Perl so cool to code with is considered the very nature of evil by the people who liked (designed?) Java, so the techie radar screens tend to be pretty much apart.

      However, Java has been hyped before it was ready to be hyped, and for the wrong reasons. Sun's vision of browsers running applets everywhere and for everything never made it, in part because Microsoft destroyed the dream of a standard JVM for applets, but mostly because Java's GUI libraries and the ISP's bandwith were not ready for primetime.

      You will notice, however, that Java sneaked into the server market before anyone noticed, and has become the standard there. Suddenly Java was all about server-side applications, and servlets have replaced the old Sun vision after (and because) Java was already a success in that field.

      2. It's aimed low. In the original Java white paper, Gosling explicitly says Java was designed not to be too difficult for programmers used to C. It was designed to be another C++: C plus a few ideas taken from more advanced languages.

      That was a sintax constraint. It has little to do with the design of the language. I think you could make Java easy for Pascal programmers with some trivial changes to the parser and 1-based indexes.

      Java has definitely different aims, and philosophies, than C++, and it doesn't aim low: binary cross-platform compatibility, transparent networking and serialization, fully object-oriented, language-level security and threading, good exception handling, etc.

      Java was not meant to run in big hardware, it was meant to run in very small hardware in a network environment without compromising security. That's no C.

      3. It has ulterior motives. ... Likewise, the reason we hear about Java all the time is not because it has something to say about programming languages. We hear about Java as part of a plan by Sun to undermine Microsoft.

      Most successful languages had nothing new to say about programming languages. They just partially implemented ideas from theoretically better programming languages, and owe their success to their sponsors' ulterior motives.

      C is just an Algol-like language. So is Pascal (which you seem to think is "bad"; have you tried Delphi?), which was very successful. So is almost every language commonly used. C++ just patched up C with some objects and generics, no new concepts there. About the only real innovation Perl seems to have is the subtext of its design and semantics, not the language itself.

      Lisp, however, owed it's failures to its innovative qualities, and it's successes to IBM and its ulterior motives. The only times I can come up with where innovation met with success is Smalltalk.

      We are doomed to reap the fruits of innovation in the second generation.

      4. No one loves it. C, Perl, Python, Smalltalk, and Lisp programmers love their languages. I've never heard anyone say that they loved Java.

      You're probably talking to the wrong crowd. Talk to a programmer/software designer.

      5. People are forced to use it. A lot of the people I know using Java are using it because they feel they have to.... These are smart people; if the technology was good, they'd have used it voluntarily.

      People were forced to use C for decades. Then they were forced to use C++ for years.

      Management rarely understand that such decisions should be left to techies, not to other management. When they don't understand the tools, they stick to (an arbitrary) one, and that's what everyone uses.

      Smart people would use LISP/ML for a lot of things. Smart people would use Delphi for database applications. Smart people would use Smalltalk for desktop applications. Smart people would use C for OS development or device drivers only.

      If you think C/C++ became the de facto standards they are because the technology is good, you are sorely mistaken. People learned C++ because they were forced to. People learned to develop GUIs in C because they had to. And people will always be forced to use a tool that is perfectly good for one thing, for something it's no good for.

      6. It has too many cooks. The best programming languages have been developed by small groups. Java seems to be run by a committee. If it turns out to be a good language, it will be the first time in history that a committee has designed a good language.

      I'm not sure, but I think the commitee was not there at the level of language design (unless you consider 5-people a commitee, in which case lots of languages, from Prolog to probably LISP, also were created by commitees).

      Whatever the case may be, Java already IS. You can judge whether it's good or bad, no need to wait. Don't confuse the language with the standard libraries (which are part of the language distribution and the Java(TM) thingie, but don't define the language).

      The commitee process in Java exists right now to standarize the libraries. For something like that you NEED a commitee.

      7. It's bureaucratic. From what little I know about Java, there seem to be a lot of protocols for doing things. Really good languages aren't like that. They let you do what you want and get out of the way.

      Java is not a hacking language. To "do what you want and get out of the way" is to do a hack, a quick one-time solution for a particular problem.

      If that's what you need, great, but Java is not the tool for that. Some (perhaps most) programming problems require more thought on the security, stability and maintainability of the solution. Java, and many other languages, are tools for that.

      Java is an object-oriented language, and by definition any OO language is bureaucratic. That's the whole point of object-orientedness: to provide extra layers of abstraction that will later allow flexibility. Messaging and more messaging. Smalltalk is bureaucratic too (it invented the bureaucracy), and yet almost all its coders consider it a great language.

      8. It's pseudo-hip.

      That, it is. But then again, if you don't take it seriously, Sun's PR is always entertaining.

      9. It's designed for large organizations. Large organizations have different aims from hackers. ... Historically, languages designed for large organizations (PL/I, Ada) have lost, while hacker languages (C, Perl) have won. The reason: today's teenage hacker is tomorrow's CTO.

      Java's libraries are designed for large organizations, but I think the language itself is not. Its only real constraint in that sense is that it is designed to exist in an insecure environment. The semantics are relatively simple and concise.

      The reason Ada and PL/I failed was because they were semantic monsters, with conflicting features, and most of the semantics they had were not understood and used anyway. C++ is closer to that situation than Java.

      10. The wrong people like it. The programmers I admire most are not, on the whole, captivated by Java. Who does like Java? Suits...

      This all depends on who do you admire, and why. If they're kernel hackers they're not going to be captivated by Java: jet pilots are not captivated by 747s, farmers are not captivated by the concept of the supermarket.

      Suits like Java. Now they like C#. Before, they liked C++, and at some point they liked an inferior OS system so much they put it everywhere and on everything (Windows? Yes, but Unix too, before). Suits like everything for about 5 seconds, good or bad, particularly if they read it can do something-ML, something-Net.

      11. Its daddy is in a pinch.

      Good point if it's true, but it would be hard for Sun to drag Java along with it at this point. The worst that could happen is that the standard stays at a stable 1.x version.

      Or actually, the worst that could happen is that Sun is incredibly successful and manages to destroy Java by being careless with the standards, but I doubt that will happen.

      12. The DoD likes it. The Defense Department is encouraging developers to use Java...

      I think the DoD likes it because it's the only other language that offers security at the language level. It's either that, or creating their own language, or keeping Ada, which is pretty much the same thing.

      --
      Freedom is the freedom to say 2+2=4, everything else follows...
    32. Re:Java's Cover by mobosplash · · Score: 1

      The same place the Perl word processors, spreadsheets, databases, operating systems and real world applications are.

      Java's good at different things. Java has been used to create really useful apps like Tomcat. It doesn't have to be good at the exact same tasks as C or C++ to be useful.

      Everyone who talks about Java being slow is comparing it to C, I never hear people say Perl is too slow by comparing it to C. On server-side apps Java is much faster than Perl CGI's. Is this evidence that Perl is lame and useless? Or just that Perl is best suited for a different problem set?

    33. Re:Java's Cover by Malc · · Score: 2

      You put great store in hacking. Large scale development doesn't involve hacking. Leave that at home with ones other hobbies: writing reliable software involves discipline, whichever language one uses. As a C++ programmer, I found Java allowed me to very rapidly write reliable programmes with minimal fuss. It is very elegant compared with C++, and anything that helps lesser programmes produce code with fewer wierd bugs makes my job easier and costs the business less.

  36. Re:Question for trolls by SweetAndSourJesus · · Score: 0

    it should be noted that this is the first time i've been modded down.

    if feels so good to be so bad.

    --

    --
    the strongest word is still the word "free"
  37. Another Thing About The Article by ekrout · · Score: 1

    Another Thing About The Article:

    1995 called. They want their story back, pronto.

    --

    If you celebrate Xmas, befriend me (538
  38. Java- Write once, run away by Graspee_Leemoor · · Score: 1, Funny

    You know, I would be a lot more impressed with Jawa bytecode. The label "utinni" would stand for any register- let the computer worry about it. If it was English it would be like saying "move 0x203 over there".

    graspee

  39. Re:Question for trolls by SweetAndSourJesus · · Score: 0

    s/if/it, but you knew that already.

    and you fuckwit mods better get on the ball, I'm looking for some negative karma here.

    --

    --
    the strongest word is still the word "free"
  40. It is just me? by zorander · · Score: 1

    Is it just me or does this article seem like a shameless plug for IBM's JRE? It seems to wil all but two of the tests (and those are regarding memory usage, not so much performance). I'm betting they picked the tests that the IBM JRE would score well on to push their own product, while letting native compilation come in second a lot of the time so it could still be somewhat of a winner. I wouldn't make decisions by these numbers in any case.

    Brian

    1. Re:It is just me? by Anonymous Coward · · Score: 0

      duh..

      You happen to notice that its from IBM's site?

      Don't get me wrong, IBM's products rock.
      There JVM is in fact really nice and runs on linux to boot :)
      But what did you expect from their own site, a push for .NET or something?

  41. Fat-binary? by John+Harrison · · Score: 2
    Back when I first learned Java (1996?) I thought that native compilation would solve some of the speed problems that came with Java. This article makes it look like the speed-up might not even exist. But let me get to my idea.

    I also realized that native compilation would destroy the cross-platform capabilities of Java. So I always thought it would be cool to distribute Java apps with both native compiled code for a specific platform and Java bytecode too. That way if you happened to be running the target platform you could get the speedup. If not you could still run the app, and maybe even compile the bytecode to a native app for your platform. This is similar to the fat-binary idea that Macs used when they switched from 68k chips to PPC, allowing a binary to run on either platform.

    1. Re:Fat-binary? by norwoodites · · Score: 0

      if every one starts to use the mach-o file format (used in Mac OS X and NeXTStep and OpenStep), you can have fat files with at least 4 different processors.

  42. This is actually old news.. by evilpaul13 · · Score: 1

    A while back, there was this thing called "C" which already does this. Some say it is faster too, but that's an entirely different dead horse needing little beating.

  43. AS400 native compilation rocks by neurojab · · Score: 1

    I've always thought AS/400's native compilation was very cool. The bytecode hangs around for compatibility purposes, and there's a hidden staticly compiled object that the system links to it. You probably haven't noticed a lot of performance benefit from it because you're already using compilation without knowing it (your default optimization level is 30 or higher) or you're using the JIT, which is also screaming these days. Try using optimization level *interpret and you'll see what I mean.

    AS/400 can also use WPO (Whole Program Optimization) when creating the program objects... something you can't get in a JIT. However, a good JIT will selectively optimize heavily used pieces of code... something not even the best native compiler can do. However, A native compile with WPO would be hard to beat with almost any program.

    1. Re:AS400 native compilation rocks by snowman153 · · Score: 1

      Our Excelsior JET and Instantiation's JOVE are two native compilers that support whole program optimization, though in JOVE it is the only compilation mode available. Execution profile may as well be used by an AOT (ahead-of-time) compiler, though I am not aware of the availability of such implementations.

  44. My Cynical Take on This: by DaveWood · · Score: 5, Insightful

    I found it interesting that this author, an IBM researcher, chose to only test a single java-to-native compiler, the GCJ (GNU product). This is an immature open-source package that I would not expect much performance from. His paper rehashes a lot of really basic info, then gives some performance results which show IBM's JVM spanking Sun, Kaffe, and GCJ. This is no great surprise; IBM is tooting it's own horn - fine, they deserve to IMHO. But as an exercise in "the state of native compilation" it's useless. What would actually be really useful is a comparison that also included at least a half-dozen other major players in the java native compiler market. I suspect you'd see some different results.

    As an aside; I see people call Java "painfully slow," but in my experience it's not that painful post 1.3. I'm not giving you benchmarks, and anti-Java people will just "no" me, but these are my experiences after a few hundred thousand lines of Java code over the past few years. Anyway, it's a good exercise to ask naysayers what _their_ basis is; they often have none.

    Also, as other posters have pointed out, the speed loss must be seen in the runtime safety context, as bounds checking and garbage collection yield stability and security dividends and, at the end of the day, we almost always want those things and are willing to wait the extra few ms for the guarantees.

    All these complaints about speed are especially ironic given how many massive wasters there are in the modern computer, _especially_ in Windows NT/2k/XP.

    But the biggest flaw in this Java vs. C debate is that often you don't get a choice between writing code in Java vs. C/C++, since you don't have the extra 50% in your time budget to do C/C++, and your real choice is between Java and VBScript...

    All the people shouting "I can write C++ 10 times as fast as you can write Java, loser" please form a line in an orderly fashion, you will be spanked in the order you arrive...

    1. Re:My Cynical Take on This: by kzeddy · · Score: 2, Interesting

      >All the people shouting "I can write C++ 10 times as fast as you can write Java, loser" please form a line in an orderly fashion, you will be spanked in the order you arrive...

      I have yet to be proven wrong that developing using C++ is any harder or time consuming than writing in Java. Arguments for usually revolve around Java's libraries and its garbage collection.
      To that i say Java's libraries are outclassed and outnumbered by the amount of source for C++ and the number of libraries like Boost ,Dinkum, etc for instance. As for garbage collection, I myself have 7 different conceptual collection systems implemented that can be easily integerated into any code you want.
      I can even make the case that developing for C++ is easier given the use of templates. Those who say that Java is easier to program in really don't want to learn the advantages of programming in C++.

    2. Re:My Cynical Take on This: by naoursla · · Score: 1
      I am more productive in Java than in C or C++. I think it is because in Java I only have to deal with a single file, while in C++ I need to keep my header and implementation files consistent.

      Java also seems to build much faster on comparably sized projects.

    3. Re:My Cynical Take on This: by FastT · · Score: 5, Informative
      I have yet to be proven wrong that developing using C++ is any harder or time consuming than writing in Java.
      From this I deduce that you are either a student or someone in academia, or someone working at a small shop somewhere writing non-commercial or only minorly-commercial software. There is just no comparison when writing large, real world commercial (or even non-commercial IMHO) software. You wouldn't need it proved to you if you saw the misery C++ causes in these situations.
      I myself have 7 different conceptual collection systems implemented that can be easily integerated into any code you want.
      You know, this is exactly what I would expect guys like you to say. You have 7 different ways, the guy in the next cube has 3, my last company had N. This is the problem. Java has this capability built into the system, it works one way, and everyone understands it, both its strengths and its flaws. Same goes for all the other class libraries you mention in you argument.

      The point is, I can come in and maintain someone else's code with far less trouble if it's written in Java than I can if it's written in C++. Same goes for the support engineers. Same goes for customers. If it's written in C++, the application can essentially be a language unto itself. You have different mechanisms for just about any major feature between development teams; none of them are standard, and none of them are even remotely as easy to learn and use as the equivalent Java API. Maintaining these applications costs a huge amount, and is fraught with support issues exactly because there are so many incompatible ways of doing the same thing.

      Your argument is so tired because it doesn't take into account the actual cost of developing real applications--maintenance and support.

      Those who say that Java is easier to program in really don't want to learn the advantages of programming in C++.
      Wrong: Those who say that Java is easier to program in (and who don't know C++) really don't want to learn the disadvantages of programming in C++.
      --

      The only certainty is entropy.
    4. Re:My Cynical Take on This: by CmdrStalin · · Score: 1

      You have to deal with a single file in Java? What are you working on, implementing cat?

    5. Re:My Cynical Take on This: by Anonymous Coward · · Score: 0

      "Your argument is so tired because it doesn't take into account the actual cost of developing real applications--maintenance and support. "

      Yeah, bla bla bla ..
      It matters not.
      I am yet to see serious desktop application written in Java ...
      Anyway, with .net and C#, Java is already history.

    6. Re:My Cynical Take on This: by Anonymous Coward · · Score: 0

      Java loser - keep on talking. The C++ rates are well over $100/hr and the Java rates keep on falling as more morons like you enter the workforce. Java = You = lowest common denominator. In a year's time when you're unemployed maybe you'll be so lucky to get a gas station job and fill up the tank of my Cadillac Escalade.

    7. Re:My Cynical Take on This: by FastT · · Score: 2
      I am [sic] yet to see serious desktop application written in Java
      Even if this were true (and it's not), what does a desktop application have to do with Java's viability? I've yet to see a serious desktop application written in COBOL, FORTRAN, or Perl. Furthermore, I have yet to see a serious desktop application written in any language for Linux. What does that say?

      Anyway, with .net and C#, Java is already history
      That's funny, since .net and C# aren't even the present yet.
      --

      The only certainty is entropy.
    8. Re:My Cynical Take on This: by Anonymous Coward · · Score: 0

      "developing real applications--maintenance and support."

      VB is even better for this kind of stuff.
      There you go; your new goal in life Java-boy.

    9. Re:My Cynical Take on This: by FastT · · Score: 2
      I hate to break it to you, but the COBOL rates are well over $200 an hour. I guess we can both see what that says about the correlation of language obsolesence to billing rates.

      Oh, and by the way, when I used to bill (I left the loser consulting lifestyle behind long ago), I billed $10,000/week for enterprise Java expertise. You do the long division.

      --

      The only certainty is entropy.
    10. Re:My Cynical Take on This: by Anonymous Coward · · Score: 0

      "Furthermore, I have yet to see a serious desktop application written in any language for Linux. What does that say?"

      Come on, you not going to hurt me there man...
      I couldn't care less about Linux.

      "I've yet to see a serious desktop application written in COBOL, FORTRAN, or Perl."

      The difference is that FORTRAN and COBOL are not even in this race while Java is right there trying to compete with C++.

    11. Re:My Cynical Take on This: by Anonymous Coward · · Score: 0

      "I billed $10,000/week for enterprise Java expertise."

      That would surely explain sudden demise of all your clients ...
      I guess Java is good for business as long as your are not on the receiving end.

    12. Re:My Cynical Take on This: by cheezehead · · Score: 2, Informative

      I have yet to be proven wrong that developing using C++ is any harder or time consuming than writing in Java.

      Hmm. Do you include debugging and maintenance as part of development? I'm sure you can type C++ about as fast as you can Java, but the work doesn't end there. One of Java's advantages is the vast reduction of memory leaks (not elimination, some guys can leak resources in any language...). In my opinion memory mismanagement is largely responsible for the typical C/C++ bug.

      --

      MSN 8: Now Microsoft even has bugs in their ad campaigns.

    13. Re:My Cynical Take on This: by myelin42 · · Score: 2, Insightful

      I know I'll get flamed for this, but ...

      If you want to use templates as well as garbage collection, you might like Managed C++, the .NET version of C++.

      It'll let you code in C++ (with templates etc) but also use garbage collected arrays etc, and the .NET class library.

    14. Re:My Cynical Take on This: by kzeddy · · Score: 1

      >How about 6 years work experience in consulting shops and software companies archtecting and implementing complete systems.

      >A few weeks ago, i took a look at the number of lines of just C++ code that are right now in production systems. passed 400,000. THAT IS ALOT OF CODE for 6 years.
      >As far as other languages go, I have used professionally (EXTENSIVELY) Java, Smalltalk , perl , Lisp, and a lot of server side scripting. I have found that people who claim to know how to program in C++ mix a vague notion of object oriented technique with every mistake you could make in straight structured C coding. I do admit that less than adequate programmers will be more destructive in the the development of a project in C++ than in Java.
      >That safety net is built into Java. its restrictions allow for them to pass by. But i do put forth that if you enforce good style and standards ,your design is not flawed from the start of the project, then these arguments fall away to the waste side.
      >Also it matters what kind of leeway your project has in terms of requirements. Sure if it doesn't matter that your program is a hog and slow then why would you want to use C++ over Java. Only once it start looking like C++ strengths are not really necessary, I start to look to Smalltalk more as a solution then Java. Ease of development is order higher than in either of Java or C++. And for team based development VisualWorks with Envy blows everything out of the water.
      >As for these GC systems that i talk about they are all interoperable and there are 7 because i like to be tight with GC and apply the right process to the right situation. All of them are component like and usually involve just a couple of lines to code.
      >Part of the problem that i have with people lauding Java's libraries over everything else is that compared to what is out there Java's libraries as a foundation are lacking.
      if you looking at what is out there and remove all the poorly written stuff it still is larger than java's class libraries.
      > In fact if I WERE a student or someone in academia then i'd say argument for Java would make more sense to me."Hmm... I do not write a lot of code. The code that i write usually does not need to efficient. And I don't want write my own foundation of utility classes bc its not necessary for my dinky little projects." ya then java makes much more sense.
      >I think you want to argue that Java is easier to LEARN than C++. Once you learn C++ properly and work with it for a while, You begin to see that java requires just as much time as C++ and you on top of that you get better performance with C++.

    15. Re:My Cynical Take on This: by FastT · · Score: 2, Insightful
      The difference is that FORTRAN and COBOL are not even in this race while Java is right there trying to compete with C++.
      That's an interesing point. It's certainly the perception, anyway. You can't write an OS or device driver in Java, but you can in C/C++. You can write an application in C++, but should you? It used to be that C++ was the only game in town for application development. It's what programmers knew, and the APIs they needed from the OS were written in the same language. It's great for writing low-level things, or things that need absolute speed, but it certainly doesn't excel over other languages for building apps, especially networked apps. Delphi/Pascal, VB, and Java are all better choices there. Why that's a problem for some people, I don't know.

      Actually I do know. Whatever tool someone last used is what they consider the best tool for the job, especially when they don't have experience with lots of different tools. It takes intellectual honesty to admit that your favorite tool isn't always the best tool for the job, and it takes a fair amount of experience and detachment to reach that point.

      --

      The only certainty is entropy.
    16. Re:My Cynical Take on This: by Wraithlyn · · Score: 2

      Well actually, with inner classes, there's no limit to what you can do with a single file.

      (Mind you, these all compile to separate class files)

      --
      "Mind, as manifested by the capacity to make choices, is to some extent present in every electron." -Freeman Dyson
    17. Re:My Cynical Take on This: by juu · · Score: 1

      FastT, you are right. Absolutely and brilliantly right. I forwarded your comments to my (C++) development team.

      But the point being - I will not convince them to switch by this, and neither have you made your point understood to the opponents of this thread.

      One can only appreciate the difference by trying both. I have. I'd take Java any time over C++, except for writing low-level stuff. I'd even go further and consider taking Python over Java in many cases.

    18. Re:My Cynical Take on This: by Pfhreakaz0id · · Score: 3, Informative

      That's funny, since .net and C# aren't even the present yet.

      Ummm, you might want to check your facts on that one. .NET has shipped. (at least, visual studio.net and the .net framework). You can download the release of the compiler and the SDK on MSDN.

      Of course, you didn't hear about it here, since slashdot refused my story. I guess the release of a brand new API the largest software company in the world has been working on for years isn't "news for nerds". Download the runtime/compiler here or the full sdk here

    19. Re:My Cynical Take on This: by Bodrius · · Score: 2

      The problem with C++ is not that it is harder to write good code, but that it's easier to write bad code, apparently because of its C-ness.

      Note that this does not have to do with the difficulty of writing up an object or method. C++ is more time-consuming because it's harder to read (and clean up) other people's code.

      Sure, templates are (were? 1.4?) sorely missing in Java, and that definitely makes the implementation of a lot of algorithms easier in C++. But other language idioms encourage "bad programming practices". Java, as a language, encourages good programming practices and makes some bad practices actually impossible. This price in flexibility pays off in maintainability and other fuzzy buzz-wordy qualities which are the whole point of not writing assembly.

      Even if there's only one person in the team that abuses some of C++ facilities everyone's time is wasted. Since "abuse" is a term relative to the code-reader and not the coder, this would happen very often.

      Then there's the issue of becoming familiar with the pletorah of libraries that exist for C++. The good thing about the Java libraries is not their amount, but the fact they're part of a standard (licensed) distribution of the language. Therefore, everyone uses them unless they have a very good reason not to, which makes it easier to read other people's code without familiarizing yourself with every library in the market. This is the advantage of the STLs for a much greater problem domain.

      Once more, it's about restricting choice to provide maintainability. It helps if the libraries don't suck (java.lang, java.util), it hurts if they do (java.awt, javax.swing).

      --
      Freedom is the freedom to say 2+2=4, everything else follows...
    20. Re:My Cynical Take on This: by Anonymous Coward · · Score: 0
      From this I deduce that you are either a student or someone in academia, or someone working at a small shop somewhere writing non-commercial or only minorly-commercial software. There is just no comparison when writing large, real world commercial (or even non-commercial IMHO) software. You wouldn't need it proved to you if you saw the misery C++ causes in these situations.


      True. I was part of the first and second wave (I like to think java is now on about
      the 4th or 5th waves if not at "high tide") and I've seen the misery of writing a large, real world, supported application in java also. I think that's part of the difference and distinction. I'd never again write a huge app in java, it's easy to do but it's hard to finish the app (make it fast, test it on several jvms, ship it, etc.) Don't get me wrong, I'd place my money on a team of experienced java developers over a team of experienced C++ developers every time when it comes to development speed and correctness, there is simply no contest in that regard, nobody with experience that I know can dispute that. I'd personally probably enjoy using the C++ app more when it's done though, it will just take twice the budget and take leadership that has been blessed by the heavens. and possibly a little luck for them to get the job done.

      Java is for small and medium sized things, not big things. And it shines at those, I think it even outshines VB and Delphi in many repects that way.


      Likewise, if I was told to start from scratch on a huge application system that had to be huge, I think there are only a couple choices, C++ being one of them as well as Ada, Eiffel and some other langauges that next to nobody knows.


      You're also right on the money, many of the things java does already are going to be things that a team of c++ guys spend 9 months arguing over and implementing before they even start the project. And then there are going to be the regular arguments and issues about why you don't use multiple inheritance on this project or only allow certain templates and certain conventions. I think a big part of it is also team work, if I'm solo, hell yeah I can slice and dice and carve it up with C++, give me a week or two to get some infrastructure classes in place and I can probably get close to hanging with a java guy. Put together 2 teams of 5 and that's an entirely different matter. And I like C++, I like it a lot.


      If it's written in C++, the application can essentially be a language unto itself.


      You said it man! Amen. At time, I've thought that the really really good examples of C++ apps were languages in themselves. By the time you nail down the dos and don'ts and pick the conventions you can be in a place where you have your own style that is very unique and it can be a great thing that's simple or it can be complex beast that makes the app unmaintainable by all but the few annointed ones. There is also something to be said for C++ developers in that 2-5 years range. I can't count the times I've seen things done for the sake of using C++. I've seen templated classes that didn't need to be, I've seen RTTI thrown in seemingly for fun, operators overloaded with no logical rhyme or reason (of course the + operator should be used to add components to a gui.. and the rest of the arithmetic operators should be ignored..) just some bizarro shit at times so someone can "learn" the language or use part of it they never do.

    21. Re:My Cynical Take on This: by egeorge · · Score: 1
      I've yet to see a serious desktop application written in COBOL, FORTRAN, or Perl.
      I've seen serious apps written in Perl. Believe me, I wish I hadn't.
  45. What does native compilation gain me... by stph · · Score: 4, Interesting

    These kinds of articles raise more questions than they answer. I have to ask what does Java native compilation gain me? Martyn writes in the article that performance and memory consumption were basically a wash on the more complex app, so what are the other considerations that might drive me to use a native compiler?

    • Does it make programming in Java easier? Not really. Most of my development environments for Java would take serious tweaking to get something like gcj to work. And somethings, like WebObjects where much of my stuff has to run might never be made to work with native code.
    • Does it make debugging easier? Now this might be a useful avenue to explore. Debugging an app that works in one JVM but not the other(s) can be a serious pain. I do a fair bit of developing on a PC and deploying on a Linux server, where the former has Sun's JVM and latter uses IBM's JVM. Maybe native compilation would help solve that, especially if you could hook back to the source code. Without source support, though, it would be troublesome.
    • Can I support my customers more efficiently with native compilation? I don't see how native compilation would make this easier. Instead of JVM differences, now I have hardware differences.
    • Does it reduce the load on my servers when I fire up these applications? We get a lot of individual JVMs running on our application servers when they are loaded up with lots of multithreaded apps and other such things. It is possible that the total footprint across a bunch of threaded apps would make this a compeling reason to explore, but Martyn's article doesn't really address that issue. Of course, our JVM proliferation could be the result of the various frameworks we're plugged into: WebObjects talking to DB2 and SQL Server databases.

    Native compilers have been here for a long time and they haven't really taken off. They either need to offer something absolutely necessary that I can't get via regular Java compilation and runtime, or they need to offer performance improvements that are orders of magnitude better than what we already have. If the vendors can do that, then I want to talk to them. Otherwise it's just another experiment in an already too busy world. Stph

  46. .NET? by Anonymous Coward · · Score: 0

    I know nobody wants to hear it, but this is sort of similar to how .NET works, except you don't have to sacrifice anything. You still would distribute your program in the platform's bytecode (or IL, whatever) but you have the option of natively compiling this bytecode to native at any point. In .NET, this occurs automatically when an assembly is executed. It's generated native code is subsequently cached and used for future execution until the assembly file is replaced by a newer version. You also have the option to natively compile the assembly immediately where it will be stored in a cache called ZAP where it will always remain. Since .NET is always JIT compiled, the resultant performance boost isn't THAT great except for initial load times.

    Hate MS all you want, this is not a bad idea.

    1. Re:.NET? by mlk · · Score: 1

      As does DE.

      --
      Wow, I should not post when knackered.
  47. Re:Question for trolls by Anonymous Coward · · Score: 0

    So, in other words, you're a fucking moron who doesnt understand the stories, and goes for (mostly) retarded humor?

  48. Defeat the purpose by tomstdenis · · Score: 1

    Wouldn't a native compiler defeat the whole purpose of Java?

    I mean C is fairly portable in the sense that any console mode app will virtually build anywhere.

    If they are moving Java to a "machine code" type system how would it improve on C [in ways that C++ didn't?]

    Personally I'm a huge C fan, I can appreciate C++ and Java too. But this going full circle crap is just stupid.

    Tom

    --
    Someday, I'll have a real sig.
    1. Re:Defeat the purpose by mlk · · Score: 1

      nope, you have .class files for people who do not use the platform[s] ou have nativly compiled to.

      I code in Java as I like the language and API set more than I like the XPness of it.

      mlk

      --
      Wow, I should not post when knackered.
  49. Nutties by Anonymous Coward · · Score: 0

    Mister AC & SweetAndSourJesus, I love you both. Really, we're probably like Musketeers or triplets or some such shit. I'd love to See a FreeBSD/Scoop site side-by-side compared to any shit-pit running Linux/Slash.

  50. what about compile time speed. by sinserve · · Score: 1

    My first two programming languages were both assembly,
    so you know I am a performance freak by nature.

    When I first tried java, the only two things that came
    between me and it were run time and compile time
    speed.
    The later has been solved by native compilers, and GHz
    speeds.
    The first is yet to be solved.

    For an edit-compile-run-debug programming language like
    java, I need the least time between edit and debug.
    The "one public class per file" policy forces some
    code modularity, and with an incremental compiler,
    speeds things up.

    But the java compiler itself is SLOOW. My energy
    is exhausted waiting to test the effect of a one line change. Turbo C did thrice that work, on my
    286, under an operating system that didn't see more
    than 640K bytes, thank you very much.

    I am much more productive, evaluating my expressions
    immediately in an emacs buffer, and running CLISP
    as an inferrior :-D

    1. Re:what about compile time speed. by gUmbi · · Score: 1

      But the java compiler itself is SLOOW. My energy
      is exhausted waiting to test the effect of a one line change.


      I found the same thing until I found jikes.

      Try it. I don't want to promise numbers (I've forgotten how slow Sun's javac is) but I'd bet you're looking at 5-10 times faster.

      Jason.

    2. Re:what about compile time speed. by mlk · · Score: 1

      But the java compiler itself is SLOOW
      javac is a java application (hence why its slow when pit against native compiler). I would be intersting to see the speed increase if GGJ'ed first.

      --
      Wow, I should not post when knackered.
    3. Re:what about compile time speed. by bolthole · · Score: 1
      I don't want to promise numbers (I've forgotten how slow Sun's javac is) but I'd bet you're looking at 5-10 times faster.

      Potentially even faster. Javac takes at LEAST 2 seconds to run. First time I typed "jikes test.java", I blinked, and thought something was wrong, because it came back pretty much immediately, with no output. I thought it was broken, but it had just compiled it immediately.

    4. Re:what about compile time speed. by dead_penguin · · Score: 2

      When I discovered jikes, I nearly cried. It's that much faster. I've easily seen improvements in compile time of well over 10x what javac does.

      For me the most painful part of java development had always been the compiles. Sitting there, waiting minutes for larger projects until everything was done. With jikes that now takes seconds. I really don't even want to think about the hours of my life that are missing from just waiting for javac...

      --

      It's only software!
    5. Re:what about compile time speed. by Myxorg · · Score: 1
      But the java compiler itself is SLOOW.

      Seems to me javac is slow cause it's a java app, and when you run it it has to load up a whole jvm for like half a second of work. If you could just force javac to stay in memory it would probally be a lot faster. Oh well.
  51. I'm the biggest expert here, listen to me! by trance9 · · Score: 5, Insightful

    Lots of experts here.

    Some experts who have never used Java want to tell me that it's no good, and will never be any good--why? They don't know, but they know!

    And some experts who want to tell me all about why Java's compilation, why it is hard or easy even though they really don't know anything about a compiler.

    And some experts on Java's market share who really don't know anything about who uses Java.

    And some experts who sat in a room where Java was... gosh gee... being implemented, telling me... well I don't quite know what, but gosh!

    So many experts here--I must be reading slashdot!

    1. Re:I'm the biggest expert here, listen to me! by Anonymous Coward · · Score: 0

      hate these comments too but
      Funny! :) [a virtual mod up]

    2. Re:I'm the biggest expert here, listen to me! by jo42 · · Score: 0, Flamebait

      And this expert, me, will tell you that both Java and Linux need to die.

    3. Re:I'm the biggest expert here, listen to me! by Anonymous Coward · · Score: 0

      Well, duh. Slashdot is a techie group and full of coders who know how compilers work and use Java daily. People claim they're experts because they are. Are you too cynical to realize that some slashdot readers might actually -- gasp -- know what they're talking about? Posting on a bulletin board doesn't automatically make you stupid.

    4. Re:I'm the biggest expert here, listen to me! by trance9 · · Score: 2

      Whatever.

      I've been writing Java code for five years. I've put some of my code into high performance situations. I've put some of it into high availability situations. I've written stuff quickly under pressure, and also other things that I took time to develop. I've worked on opensource projects (webmacro, now running AltaVista, is java) and after all that time, and all that experience, I just don't think I know enough about it to say "JAVA SUCKS! IT MUST DIE!" or to say "JAVA IS GREAT! GIVE UP ON C/PERL/XXX RIGHT NOW!"

      Sometimes it's been difficult to get what I need to do done, or to make it fast, or reliable enough. But I've always managed to do it, and I haven't found my life any more or less difficult than when I wrote C++ or PERL. I tend to find that Java fits the work that I have to do, but I can see quite clearly that it doesn't fit other work.

      I wish that on slashdot the size and strength of peoples opinion was somehow proportional to their expertise or experience--but unfortunately it's not.

      I came here expecting something interesting and instead found a bunch of technically inaccurate crap coupled with some ridiculous opinions (I really liked the "I learned all I need to know about Java from a bookstore--it sucks!" obviously the voice of experience there).

      It seems the more experience people have the more likely they are to judge that a tool does fit some things and fails to fit others.

      It seems the less experience people have the more likely they are to thump on their favorite bible and insist that the whole programming would should switch to use their favorite tool, and everything else "must die!".

      I'll let you judge whether you think that sounds like the voice of expertise.

    5. Re:I'm the biggest expert here, listen to me! by leuk_he · · Score: 1

      I've been writing Java code for five years

      I am confused. Is this a troll? is this you being trigger happy?

      OR are you going to the learning phases of ANY technical stuff:
      -I Don't know know anything about it.
      -I learning about it, just give the time.
      -I know a lot about it, just some details i have
      to fill in. (A lot of experts at /. are at this level)
      -I know a lot about it, if you give me enough time i will get all the latest details.
      -I Never have time enough to learn all.
      -I will never know all the details about it.

      I'll let you judge
      OK, A post ending with "find it out yourself", don't bother to reply is not a troll.

      By the way, I am a zero about java, I just ran the first sample program's of sun's tutorial.

  52. Hold on. by Anonymous Coward · · Score: 3, Informative

    There's a thread about this article over at the gcj's mailing list: here.

    The author chimes in, BTW.

    1. Re:Hold on. by crisco · · Score: 2
      That thread also references this page that has a bit more comprehensive bit of performance testing.

      A quick scan seemed to indicate that Sun's HotSpot, IBM's JVM and GCJ all do very well.

      --

      Bleh!

  53. C++ best feature is now within reach of Java... by Anonymous Coward · · Score: 0

    Core dumps.

  54. prime example rewriten in C++ results by Anonymous Coward · · Score: 0

    Don't be so sure - Java is still quite slow. However, I really don't know why the gcj results in the article were so slow considering no objects were created (no heap to contend with) and this was a purely CPU bound benchmark. Gcj uses the same compiler back end as gcc which delivers 3X the speed of java:

    $ cat prime.cpp
    #include <stdio.h>
    inline int isPrime(long i)
    {
    for (long test = 2; test < i; test++)
    if(i%test == 0)
    return 0;
    return 1;
    }
    main()
    {
    long n_loops = 50000;
    long n_primes = 0;
    for (long i = 0; i < n_loops; i++)
    if (isPrime(i))
    n_primes++;
    printf("%d primes found\n", n_primes);
    }

    $ gcc -O3 -o prime prime.cpp
    $ time ./prime
    5135 primes found

    real 0m17.885s
    user 0m17.785s
    sys m0.070s

    Using JDK 1.3 (JIT) on the same machine:

    $ time java prime
    5135 primes found
    Time taken = 59886

    real 1m0.497s
    user 0m0.030s
    sys m0.050s

    $ time java -server prime
    5135 primes found
    Time taken = 60387

    real 1m1.228s
    user 0m0.050s
    sys m0.050s

    The C++ version of the code takes 17.8 seconds versus 60 seconds for the equivalent Java code.
    The memory consumption in the C++ program was less than a third of the Java program.

    1. Re:prime example rewriten in C++ results by __Reason__ · · Score: 2, Informative

      Your C++ version is not comparable. A "long" in Java is 64 bits. A "long" in C++ is 32 bits. The Java code is doing far more work.

      Change the Java code to use "int" or the C++ to use "long long" for a fairer comparison.

    2. Re:prime example rewriten in C++ results by Anonymous Coward · · Score: 1, Informative

      Even with the "long long", C++ is still 50% faster than Java/Hotspot (and uses one third the amount of in-process memory):

      $ cat prime.cpp
      #include <stdio.h>
      inline int isPrime(long long i){
      for (long long test = 2; test < i; test++)
      if (i%test == 0)
      return 0;
      return 1;
      }
      main(){
      long long n_loops = 50000;
      long long n_primes = 0;
      for (long long i = 0; i < n_loops; i++)
      if (isPrime(i))
      n_primes++;
      printf("%lld primes found\n", n_primes);
      }

      $ gcc -O3 -o prime prime.cpp
      $ time ./prime
      5135 primes found

      real 0m41.019s
      user 0m40.888s
      sys m0.080s

      Using JDK 1.3 (JIT) on the same machine:

      $ time java prime
      5135 primes found
      Time taken = 59886
      real 1m0.497s
      user 0m0.030s
      sys m0.050s

      $ time java -server prime
      5135 primes found
      Time taken = 60387

      real 1m1.228s
      user 0m0.050s
      sys m0.050s

      I admit that the Java prime benchmark is quite lame, but results like this for Java vs. C++ is pretty typical.

    3. Re:prime example rewriten in C++ results by JukkaO · · Score: 1

      I admit that the Java prime benchmark is quite lame, but results like this for Java vs. C++ is pretty typical.

      Wouldn't the perceived slowness here be due to the JVM startup time, which really shows in this kind of "benchmarks". People using Java for run-once-quick apps deserve what they get anyway :)

      --
      .SIGSEGV
    4. Re:prime example rewriten in C++ results by Karellen · · Score: 2

      No, a 'long' in C++ is _at_least_ 32 bits. It may be more. Especially on 64-bit systems.

      C++ doesn't have a 'long long' type. You're thinking of C99. Or a compiler-specific extension. (And, IMO, 'long long' is really fscking ugly. 'longlong' (one keyword) would have been better if it was _really_ needed, which it wasn't. Stupid decision by the C9X committee if you ask me.... :-)

      --
      Why doesn't the gene pool have a life guard?
    5. Re:prime example rewriten in C++ results by Anonymous Coward · · Score: 0

      Wouldn't the perceived slowness here be due to the JVM startup time, which really shows in this kind of "benchmarks". People using Java for run-once-quick apps deserve what they get anyway :)

      If you look at the Java data you can clearly see that startup time is only less than a second:

      $ time java prime
      5135 primes found
      Time taken = 59886
      real 1m0.497s
      user 0m0.030s
      sys m0.050s


      "Time taken" starts ticking from when the java prime main() actually starts. The "real" time measures both the java process firing up and the running of the java prime application. If we subtract the two we get the java startup time: 60.497 - 59.886 = 0.611 seconds in this case.

      Considering the C++ program took 20 seconds less time than the equivalent Java program, the Java startup time was not relevant to this benchmark.

    6. Re:prime example rewriten in C++ results by angel'o'sphere · · Score: 1

      Oh man ...

      My last post some idiot moderated as flaimbate and the answers where mostly flames :-) and where not modded, ha ha.

      Well, your post is good but you measure wrong :-(

      With the unix "time" command you mainly measure the start up time of the JAVA VM.

      Embedd the measurement into your application.
      Make for the C program a function and for the JAVA version a static method.

      Then make a wrapper around it wich calls the function/method 100 times (or more often) and measures that time.

      I admit that the Java prime benchmark is quite lame, but results like this for Java vs. C++ is pretty typical.

      Yes :-) they are typical because no one very good in the C++/C area is realy good in the java area as well(or other way around). Most benchmarks are done by people who are biased to the one or the other ....

      Also you have to bear in mind: low level machine instructions are easy to optimized for a specialized compiler. But a JVM vendor would not invest that efford as it butter and bread is the VM and the environment not the top performance on any version of x86 processor.

      Regards,
      angel'o'sphere

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    7. Re:prime example rewriten in C++ results by JukkaO · · Score: 1

      If you look at the Java data you can clearly see that startup time is only less than a second:

      Damn, I need to start _reading_ the posts before replying :)

      --
      .SIGSEGV
    8. Re:prime example rewriten in C++ results by Anonymous Coward · · Score: 0

      Read the original post again. The JVM startup time is less than a second. Considering the C++ program was 20 seconds faster than the java program - the JVM startup time is not relevant. By the way - who would use java at all if it had a startup time of more than a second for a 10 line program? No one.

  55. Bad review by Animats · · Score: 5, Insightful
    The simple case, the prime number finding loops, should have been followed by an analysis of the object code to find out why the native compilation is so slow. Look at the inner loop:
    • for (long test=2; test < i; test++)
      { if (i%test == 0) { return false; }
      }
    If the compiler generates slow code for that, something is very wrong in the compiler.

    On the safety front, subscript checking is almost free if done right. Subscript checking can usually be hoisted out of loops. Old studies on Pascal optimization showed that 95% of subscript checks can be optimized out at compile time without loss of safety. GCC, though, being a C compiler at heart, isn't likely to know how to do that. Merely putting a Java front end on it doesn't make it a Java compiler deep inside.

    1. Re:Bad review by Stormie · · Score: 2

      for (long test=2; test < i; test++)
      { if (i%test == 0) { return false; }
      }
      If the compiler generates slow code for that, something is very wrong in the compiler.

      According to this message to the GCJ mailing list, it's because GCJ doesn't produce particularly good 64-bit integer math code..

    2. Re:Bad review by Jordy · · Score: 2

      Just as a quick test I decided to build his Java program with my version of Javac and also write a C version that is basically identical with the exception of the time/print calls and variable ordering and compiled it with both GCC and G++ under MacOS X (PPC.)

      Java version: 51250 ms
      C version: 6392 ms
      C version compiled with G++: 6412 ms

      If GCJ can approach even half the performance of G++ in the future it looks like it'll be a complete win over Javac. As I understand it, Apple's version of Java is quite good, but the two just don't compare.

      --
      The world is neither black nor white nor good nor evil, only many shades of CowboyNeal.
    3. Re:Bad review by Florian+Weimer · · Score: 2

      AFAIK, the GNU Ada compiler is not too bad on eliminating unnecessary bounds checking (array bounds checking usually only adds a penalty of a few percent), so something can be done even in the GCC context.

      BTW, I would expect that gcj-compiled Java applications start much more quickly than entire VMs. The comparison doesn't seem to take this into account.

    4. Re:Bad review by briansmith · · Score: 1

      Bounds checking _must_ happen in the JVM. The compiler cannot reduce this workload at all. The reason: for security reasons, the JVM cannot trust the code that is generated by the compiler, because it cannot trust the compiler. This is the old argument that states that you cannot trust your own software any more than you trust the software that you use to create it.

      Now, the JVM can hoist the checking out of the loop in the bytecode->native code (JIT) processing, since it trusts itself.

    5. Re:Bad review by kenthorvath · · Score: 2

      Actually, that is a pretty bad algorithm for factoring primes. You can get at least a 50% performance increase by testing 2, starting at 3 and then incrementing by 2. You can gain another 50% by stopping at test=floor(sqrt(i)).

    6. Re:Bad review by jwcoffin · · Score: 1
      I think this shows that it is really dependent on what JVM you are using. I did the same thing on my machine (Windows 2000 1GHZ).

      I ran it with IBM's, Suns and a C++ version under Visual C++

      Sun: 17696
      IBM: 5138
      VC++: 5368

      I don't know if this says more about IBM's VM or the C++ compiler. I am surprised about how poorly Apple's VM did though.

    7. Re:Bad review by btlzu2 · · Score: 1

      Obviously you're right, however, your point is purely academic. He was just measuring the performance of a loop which will calculate something on every iteration, not optimizing a prime number algorithm. In other words, it doesn't matter for this study as long as the same loop is executed for each test.

      --
      Zed's dead baby. Zed's dead.
    8. Re:Bad review by Animats · · Score: 2
      it's because GCJ doesn't produce particularly good 64-bit integer math code..

      Ah. That's surprising, though, because GCC was one of the first compilers to do 64-bit integer operations in the x86 FPU, which has good 64-bit integer capability. Why didn't that get used for Java?

    9. Re:Bad review by Stormie · · Score: 1

      Ah. That's surprising, though, because GCC was one of the first compilers to do 64-bit integer operations in the x86 FPU, which has good 64-bit integer capability. Why didn't that get used for Java?

      You've lost me here. I'm no x86 guru (only assembly coding I've done recently is for the PS2) but I thought the only 64-bit integer instructions were added in SSE and SSE2? (and the benchmarking on the IBM article was done on a Pentium II so wouldn't have had either of those available). Are there tricks you can do just with the FPU for 64-bit integer maths??

    10. Re:Bad review by Karellen · · Score: 2

      Duh!

      1) Factoring primes is easy. I can factor any prime you care to name in my head in no seconds flat.

      2) The algorithm is a test of how quick the code is to run, not how quickly you can produce primes. If they made a better (say 2 times as quick) algorithm, but wanted to eliminate startup and shutdown costs as much as possible, they'd make the loop longer (say twice as long) to get the same amount of runtime.

      --
      Why doesn't the gene pool have a life guard?
    11. Re:Bad review by mikera · · Score: 1

      Hmmm.... since using sqrt(i) chances the algorithm from O(n) to O(n^0.5) I'd say the speedup was a lot better than 50% in all but trivial cases.

      Minor nitpick I know - but these things can make a real difference. I once saw some code-monkey write an O(n^4) sort algorithm..... writing code that bad actually takes some talent.

  56. Java for servers by Nick+Mitchell · · Score: 2, Insightful

    Java, in the form of EJBs and servlets, is becoming fairly common on "big iron". One reason is indeed the cross-platformability of it. But, frankly, most often a change in platform accompanies a change in framework. For example, a switch from UNIX servers to a mainframe may accompany a switch from CGIs to an application server (such as Websphere). The dramatic switch here is probably not from UNIX to OS/390 (after all, OS/390 has a POSIX layer), but from CGIs to Websphere. So, as you said, it's not really cross-platformability which is driving Java in the server realm. I think the principal reason is that Java provides (at least some semblance of :) a language-level security model. By security, I don't mean crypto and virii and external attacks. I mean an application is secure from itself, and its (all too human) programmers.

    1. Re:Java for servers by norwoodites · · Score: 0

      Java is as secure as the vm is.
      So if the VM is not very secure then you have problems.

    2. Re:Java for servers by CrazyLegs · · Score: 4, Interesting

      I agree with your points, mostly. The company I work for has a TON of function implemented on Websphere running on AIX. We really haven't cared too much about cross-platform features (do a bit of sharing between NT PC apps and Websphere AIX). We were an early adopter of Java because it seemed to address a lot of issues we had in developing C++ and Smalltalk apps (e.g. packaging, garbage collection, change mgmt, etc.).

      However, we are planning to move our Websphere AIX implementation (for EJBs anyways) to an IBM390 box (or Z Series these days I guess) and we've found the proof-of-concept effort easier than we anticipated - simply because we can pickup our code (in JARs) and run it on big iron. Very nice! It also gives us some encouragement that we can really start to share more Java classes/components between browser-delivery and fat-client environments if we're smart about it.

      Anyways, just one experience that's worked out...

      --

      CrazyLegs

      "Pork!!" said the Fish, and we all laughed.

    3. Re:Java for servers by civilizedINTENSITY · · Score: 1

      "Secure from itself." I've wondered why Lisp hasn't seen use for this very reason. Languages that aren't capable of core dumping seems like a good thing.

  57. IBM JRE is surely the winner....but wait.. by jsse · · Score: 3, Interesting

    It's being done by IBM, anyone would think it's biased? :)

    Don't get me wrong, I'm a big fan of IBM, and IBM has really, really made a JDK multi-times out-performing SUN's JDK.

    However, I'd believe the selection of 'opponents' are simily..unfair. :)

    Kaffe is surely an easy-pick. Yes it's the only GPL JDK out there but many people(at least Java developers here) would avoid kaffe as it has a fatal security flaws that kaffe team doesn't seem to want to solve it. :/ (We call Kaffe 'MS' JDK'2, not just for humor, but it's really the case. ^_^)

    Even the GNU people know gcj is slow, even GNU guys know it; but speed is not a real issue for gcj, it's basically a starting point for all implementation - or reference implementation as we like to call it. We would pick a commercial java compiler if we need it.

    SUN's JDK, well...you know what I think it just what you think - IT'S SLOW! Yes, we all know that. :D

    Nevertheless I think developer's work is doing a great job here, it confirms something everybody know - that IBM's JDK is fast, and that's it. I don't see it could conclude the performance of native compiled java programs. Unless they include all other commercial java compilers into testing, I wouldn't think we have reached a conclusion yet. :)

  58. IO Performance by 8string · · Score: 1

    I have been a java developer for about 5 years. When I first heard of GCJ, I decided to try some informal benchmarking. One area which has sucked with java is IO performance. Sun is addressing this with jdk 1.4, but in a real world business environment, jdk 1.5 will probably been in production before anyone is switching. Anyway... My benchmark consisted of creating a text file of arbitrary length (1024 bytes was the default I think), and I found that IO performance with GCJ was even slower than java IO with the sun jdk. This was about 6-12 months ago, so GCJ may be better now, but at the time, all I could do was laugh. Take something which sucks, and make it suckier is not a way to gain market acceptance. ;)

    1. Re:IO Performance by __Reason__ · · Score: 1

      GCJ's I/O performance is pretty good in my experience. If you have some code that runs significantly slower with GCJ vs JVM, the least you could do is write to java@gcc.gnu.org and tell us about it. We can't fix performance problems that we don't know about.

      Bryce.

    2. Re:IO Performance by 8string · · Score: 1

      I would assume that you do your own benchmarking against various jvms, but had I known this information was useful, I certainly would have emailed you.

  59. Sorry, Java always need a JVM by dnoyeb · · Score: 0

    What he should have said was, "without the need for an additional external JVM." But if it does not run in a JVM, it is not Java because that is part of the language specification. Native compilation is basically "statically linking" to the JVM. It does not make much sense to me. Its only forced because M$ does not put a quality JVM in with their OS so every java app decides to include their own. Its stoopid because the java app should just install the default JVM if its not there, not have 10 different apps each with a statically linked copy of the same JVM within them wasting 20MB... I have YET TO SEE a real native compiled java code. Sure if its non graphical and does not use swing. But you can not just take the whole java library and compile it to true native form. It just aint java no more, not that that is a problem, long as it works. But if your strip Java of most its benefits, why use it?

  60. I've wanted native Java apps for a long time... by stickb0y · · Score: 1

    Most of the programs I write are small, text-based, unix-like applications.

    I'd like to use Java because of its garbage collector, string, and exception support. The explicit memory allocation required by C/C++ is annoying (even more so without elegant error handling), and string manipulations are tedious in C.

    The problem is that the VM is too bloated for small programs like this. What? I have to load a several megabyte (or more) VM into memory to run a program that's less than 100 KB?

    And what if I want to distribute these programs? What? I have to ask users to download and install a several megabyte (or more) VM to use a program that's less than 100 KB?

    And then there's the joy of dealing with different VM versions. What fun. Is there any kind of guarantee that future VMs and future libraries will behave the same way as the current ones? If so, backwards compatibility makes them even bigger.

    As far as cross-platform issues go, I really don't care. I'd rather cross-compile if necessary, and as long as the source code is portable, that's good enough for me.

    1. Re:I've wanted native Java apps for a long time... by snowman153 · · Score: 1

      If your programs are not using any GUI, Excelsior JET Pro shall compile them to standalone EXEs (not that small as if they were written in C/C++ - "Hello, World" is a 720KB EXE with JET 2.1).

  61. Second that! by f00zbll · · Score: 1
    IBM has done great things for Open source and java, but I also found the article to be biased. From personal experience, for the same clock speed, Java runs considerably faster on Solaris 7 or 8 than on linux or windows. The catch to the whole thing is for most web apps Java running on 1.5ghz+ will probably be faster than a Sun box running at 440mhz ultra sparc.

    On the otherhand, companies buy Sun hardware not for pure speed, but for reliability, redundancy and proven scalability. The one thing all these benchmarks fail to address is "how important is speed over reliability and scalability?" A good programmer can take out lots of security, memory management and allocation checks to make it run really fast, but how stable will it be? Will it be solid enough to run 24/7 with 1% downtime? With the way CPU speeds are increasing, who cares about speed. Lets talk about the real issues, ease of development, maintainability of the code, built in document creation, wide selection of prebuilt libraries, consistent and solid security model and portability between platforms. My personal experience, large companies use a variety of platforms, so a windows only solution is not an option. A solution that allows multiple developers on different platforms to build their pieces and integrate is what many large projects require. Doing so with C can be done, but how many people feel C code is easy to maintain? I don't know that question, since I've never coded in C. Those I know who use C joke about how unreadable C becomes. Bottom line, each tool has it's strengths and weaknesses. It's about which problems you want to live with.

    1. Re:Second that! by Sivar · · Score: 1

      The Ultra-SPARC chips are faster at the same clockspeed period. They are server class 64-bit chips with integrated PCI controllers running on an OS whose core parts were largely written in optimized assembly language. You'll notice that Java runs faster on an AthlonXP than A Pentium 4 as well--not because the XP implimentation is better (in fact, it will probably be the exact same), but because the XP is a faster chip/Hz.

      That said, Sun may have spent extra time optimizing the JVM for the SPARC... It makes sense for a hardware company to do so. I'd love to run my java apps on a Sun, but any decent maching startng at around $30,000 turns me off.

      --
      Computer Science is no more about computers than astronomy is about telescopes. --E. W. Dijkstra
    2. Re:Second that! by leuk_he · · Score: 1

      Will it be solid enough to run 24/7 with 1% downtime?

      Do you really think 99% uptime (which is not very high) relies on a good programmer who optimizes a program?

  62. Java Native Compilation by PRR · · Score: 4, Interesting

    One of the best articles on native compilation is this performance report

    Also see on Javalobby the The "native compilation" myth and RFEs for JDK1.5 threads which discuss native compilation.

    Yes, there are some companies like Jet and Jove (and GCJ) making native compilers, but I'd like to see a company of the clout of Sun (or IBM) make native Java compiling more accessable by having a "javac -native" option with their JDK and a smaller standardized runtime (instead of the full JRE) specifically for native compiled apps. The most likely target for native compiled apps running w/o a JVM would probably for the client/desktop side which don't have the resources of server boxes. Remember... it would be an OPTION in the JDK... the old bytecode compiling for VM/JIT would still be there.

    It's arguable whether the runtime performance of a native compiled app would be substantially better than JIT compiled (if some of the Hotspot tricks were moved upstream into the JDK compiler?), but there are also other advantages, such as a faster startup time (no need to startup a VM processes and JIT compile) better memory usage (no need for VM process as well as the meta data and bytecode which must be held in memeory). There would also be some drivespace savings as the full JRE wouldn't be needed (though at this time, a developer can't include a partial runtime, Sun wants the full thing if they include one... Sun needs a change of heart and make a standardized smaller runtime for native apps). Also, with native binaries an obfuscator (used for btyecode classes) isn't needed for commercial apps for those who want to keep their code proprietary.

    There are lots of suggestions going around for the VM/JIT issues such as loading the VM at bootime, a singular shared VM, and JIT caching. These workarounds aren't neccesary with JVM-less native compiled apps.

    Of course, there are WORA extremists who don't like this idea of native compilation because it goes against the dogma of only needing to compile ONCE and run on any OS with a JVM. IMO, as long as the source stays the same, compiling natively for different OS's is still pretty near to the WORA ideals. The Java language is VERY tweaked for portability as-is. It's the OPTION of native compiling that should be available in the Sun or IBM JDK.

  63. *cough* by k2x · · Score: 0, Offtopic
    I'm not giving you benchmarks, and anti-Java people will just "no" me

    NO.

    Java sucks, and so do all derivatives of Visual Basic(VBA, VBs, etc). Whoever designed that pile of shit deserves to die.

    The more you program in these languages, the more stupid you get. no joke. You'll notice such ppl instantly when they say, "Well, why don't u use java to write a kernel?". OMG. The end of time is approaching.

    1. Re:*cough* by CmdrStalin · · Score: 1

      Thank you for your lucid commentary.

  64. Re: PDAs - Active links by Bigger+R · · Score: 1

    Once again with feeling (sorry I forgot, under deadline):

    Jump Project

    SuperWaba

    --
    Beta only seems to work for Google. Such a shame.
  65. either embed the jvm or the compiler - you choose by S.+Allen · · Score: 2

    You simply can't run most Java programs without either a JVM or a bundled compiler. The reason for this is dynamic class loading. You can load classes by arbitrary name, from urls, from byte codes you've created on the fly in memory, etc, etc. These classes cannot be precompiled. So you either need a JVM to interpret them, a compiler to compile them, or both in the form of a jitted JVM.

    Why do people complain about the size of the JVM? Every scripting language has to have the equivalent in the form of an interpreter. The *base* perl installation on Linux is 21MB. That's without docs and a UI toolkit (Java includes both). I don't hear complaints about the size of Perl's interpreter or the heft of the Tk or Gtk toolkit libraries.

    Would people like Java more if it didn't have byte codes? If we had a Java shell like Perl, Tcl and Python? Skip the byte codes and let it be tokenized each and every time? Or is it just the cross-platform talk that rankles everyone? Maybe it's Sun's stupid open/not-open antics. Or perhaps it's just language l33t1sm.

  66. Free Java Performance Book by WilsonSD · · Score: 2, Informative
    For anyone that wants to learn more about Java performance tuning you might want to check out my book. You can read it online here:

    http://java.sun.com/docs/books/performance/

    -Steve

    1. Re:Free Java Performance Book by teeko · · Score: 1


      I've just finished reading this book (hardcopy) and it's well worth a read if you are worried about the performance of your apps, lots of interesting hints and tips.

      The two appendices (The Truth about Garbage Collection and The Hotspot VM) in particular are very useful reading.

  67. Java Question. by cgleba · · Score: 0, Troll

    I am not a Java programmer and am by no means an expert at all, however I have a question that perhaps the experts can answer (this is not a flame nor flamebait -- it is a valid question that I have always had, asked many times, read a lot about and still can't find a good answer to). What are the merits of using Java? Why is Java so special? I have asked this question to many Java developers and I never get a good answer.

    The answers I typically get are not related to the programming *language* at all, but the organization and "java culture":

    1) "Java classes are well-organized and well-documented and all-in-one-place." Not a language mertit! You can learn C++ classes as well.

    2) "Java stops you from your own stupidity by not allowing pointers and has garbage collection." If you REALLY hated pointers that much you could write C++ code without pointers and write your own garbage collector (not to mention that LISP does garbage collection too -- nothing new).

    3) "Java is cross-platform." I haven't seen too many implementations when cross-platform is needed at run-time. The browser cross-platform stuff seems to have died in the browser wars and Java incompatibilities in browser implementations, thus most Java developers that I know are making JSPs. You know the platform of your server (it won't randomly change without you knowing) so why not write in a higher-level language such as C++ and skip all the platform-dependant code (or do ifdefs) and have it run natively faster? If your platform changes you just re-compile. . .this article about native Java code is just this. . .

    4) "Java has a cross-platform GUI". So is GTK and QT.

    5) "Java is easy to learn". I'll skip that.

    6) "Java has javabeans, etc". Not a language merit!

    Other then the "java culture" and the fact that it's libraries are well organized, what are the real-world (not theoretical) merits to Java? Why program in Java when you can achieve the same result faster in another language? This is a serious question that has plagued me for years and I would love a good answer if anyone has one. It is a little off-topic however it does relate to the article because the article promotes killing one of the valid merits that I know of for Java (cross-platform).

    1. Re:Java Question. by jjohnson · · Score: 1

      Perhaps the reason you never get a good answer is because your scepticism about an answer positive to Java is apparent.

      This is anecdotal, but programming useful vertex, edge, and graph classes for an AI test took me three hours in Java. It took me three weekends in C++.

      The difference lay largely in having no memory management to worry about, and having good container classes and enumerators. It took a long time to get the kinks out the C++ classes (and that was using STL vectors and iterators).

      The less complex java syntax made it all straightforward. The more complex C++ syntax had me tripping all over the place, and I've written more C++.

      An experienced C++ programmer wouldn't have had the problems I did, but then I'm not an experienced Java programmer, either.

      My test was small, so there were no noticeable performance differences on which I can comment.

      --
      Anyone who loves or hates any language, platform, or manufacturer, doesn't know what they're talking about.
    2. Re:Java Question. by jjoyce · · Score: 1
      You have neglected to mention the one great thing Java has going for it: hype! But seriously, I'll try to answer your questions.
      1. You can learn the C++ classes, but there is only one standard class library: the STL. Not to mention the fact that much of the high-level functionality that exists in Java (e.g. networking) you'd have to implement yourself or get from a third party if you used C++.
      2. Why reinvent the wheel? Not everyone has the time to go write a garbage collector. Java gives you one. Also, you will never be able to avoid using pointers if you need to use third party class libraries.
      3. #ifdefs are extremely inelegant and make code maintenance a pain in the ass. Why not just use a language with the knowledge that it will run elsewhere? No more wondering how many bits are in an int on xxx platform.
      4. I haven't ever used GTK or QT, but why not use the graphical components that are developed and tested by the same people who wrote the language?
      5. Java the language is quite easy to learn. However, learning the class libraries it has will take some time because there are so many.
      6. I agree with you here.
      The real-world merits are that your development time will be shortened because you won't be buried in syntax, or have to chase pointers around, or have to worry about memory management as much, and much of the higher-level functionality has been thoroughly tested and used by countless others before you because it's part of the standard classes.

      Now, Java isn't a panacea (games programmers will probably stick with C++ for a while), but I think the reasons I outlined above make it more appealing than C++ for many, many purposes.

      Think of just about any application that you might write and imagine the steps toward completing it. At each step consider how long it would take to accomplish that step in Java vs. C++. I think you'd find that C++ would have you finishing it several months after you'd finish it with Java. Not everything is a performance issue.

    3. Re:Java Question. by Sivar · · Score: 1

      1) The better organization (and more sensical naming) are part of what make Java easier to learn, giving the programmer more time to master.

      2) How many Joe Programmers do you know that can write their own garbage collector? What if that custom garbage collector has horrible bugs? When you need to write a program quickly and its stability and security are paramount, Java all but eliminates these worries. As far as Lisp and others having garbage collection--yes, that is true, but few programmers know Lisp (other than tweaking a little EMACS). Why is NT so popular for networking? For its merits? (HA!). It's much easier to find an MCSE than a Unix admin--and cheaper. The same goes with Java VS. Lisp, Smalltalk, or even C++.

      3) This often isn't that big of a deal, but it is great for the 10% of the time that it is a big deal. As far as browser incompatibilities, sticking with basic Java 1.1 or 1.2 tends to be very safe, but I haven't delved much into that realm.

      4) I wouldn't really mention that part if I were asked about the merits of Java, but to Java's credit its GUI libraries are part of the language spec. GTK+ and QT are definitely not part of the C spec, so it is not reasonable to expect a platform that can run C apps (all of them) will be able to run C apps that call GTK+ or QT functions. If you make a button in Java, that button will work simply by virtue of the fact that the platform runs Java. At least in theory...

      5) Me too.

      6) I know little of Javabeans.

      Hope this helps a little.
      Note that despite the above, I still prefer C or PERL for almost everything.

      --
      Computer Science is no more about computers than astronomy is about telescopes. --E. W. Dijkstra
    4. Re:Java Question. by cheezehead · · Score: 1

      1) "Java classes are well-organized and well-documented and all-in-one-place." Not a language mertit! You can learn C++ classes as well.

      Yes, of course you can learn C++ classes. However, they don't usually come with the language (for free). Having the Java libraries ensures a certain degree of standardization. I think a lot of Java's strength comes from the bundled libraries (reuse at work...).

      2) "Java stops you from your own stupidity by not allowing pointers and has garbage collection."

      That's a valid point, I think. An awful lot of hard to find bugs are caused by memory mismanagement. Not to mention all these security holes that allow buffer overflow exploits.

      If you REALLY hated pointers that much you could write C++ code without pointers and write your own garbage collector

      Writing your own garbage collector ain't all that simple if you want it to be safe and efficient. A lot of research has gone into the Java GC, you don't write something like that on a rainy afternoon.

      (not to mention that LISP does garbage collection too -- nothing new).

      Sure. The fact that it's nothing new doesn't take away its value, though.

      3) "Java is cross-platform." I haven't seen too many implementations when cross-platform is needed at run-time. The browser cross-platform stuff seems to have died in the browser wars and Java incompatibilities in browser implementations, thus most Java developers that I know are making JSPs. You know the platform of your server (it won't randomly change without you knowing) so why not write in a higher-level language such as C++ and skip all the platform-dependant code (or do ifdefs) and have it run natively faster? If your platform changes you just re-compile. . .this article about native Java code is just this. . . .

      I agree with you here to a certain degree. Cross-platform often is not needed, and 100% cross-platform rarely happens anyway. Java code is a little easier to port than most languages, but it's more of a convenience than a compelling advantage.

      4) "Java has a cross-platform GUI". So is GTK and QT.

      Again, that doesn't mean it's not an advantage.

      5) "Java is easy to learn". I'll skip that.

      Why? I've programmed in about a dozen different languages, and I kind of like Java, without being a zealot about it. In my opinion, Java is indeed somewhat easier to learn than most languages, especially if you come from a C/C++ background. Of course the challenge then is to avoid all you bad C/C++ habits...

      6) "Java has javabeans, etc". Not a language merit!

      That's basically a repitition of your argument about the libraries. Again, it may not be part of the core language, but it sure can be useful in certain circumstances.

      Why program in Java when you can achieve the same result faster in another language?

      Ahh, but that is interesting! You say you're not a Java programmer, and yes, in that case programming in a language that you do know will be faster, obviously.
      However, I can assure you that developing a solution with Java is generally faster than doing it in, say, C++ (assuming you have roughly the same knowledge of both languages). A large part of this is due to the libraries.
      A small example: some time ago I had to write a C program to manipulate an Oracle database. It took me a whole week just to write 1200 lines, mainly because of the horrible API calling conventions. I think I could have done the same thing in half a day , in 100 lines, using Java and the JDBC classes.

      Granted, Java is not the optimal solution for all problems. Some string manipulation stuff is probably easier done in Perl (or another language optimized for string manipulation). Every problem has its own optimal solution, but as a general-purpose language, Java is pretty good.

      --

      MSN 8: Now Microsoft even has bugs in their ad campaigns.

  68. Better idea by Anonymous Coward · · Score: 0

    Just distribute the bytecode, and let customers run a bytecode-to-native compiler when they install the app...

  69. Excelsior JET by LadyLucky · · Score: 2, Insightful
    For my own curiosity, I compiled an interpreter I had written in java using this, just to compare the performance.

    It took forever to compile, but once it was done, I had a (large) executable for my native platform, windows.

    It ran about 30% slower than the JDK. There are a number of things that are still pretty slow in java, but in general, it's a pretty fast language these days. JIT compilers and hotspot to a good job. It can never be as fast as C++ due to things such as GC, but the performance tends to be close for most applications.

    This is indeed interesting, but I think it is entirely irrelevant. Speed of execution is usually about 7th on the list of important-stuff-im-thinking-about when choosing a language and starting a project. There are so many more important things, such as maintainability, scalability, code reusability, code robustness (the number of stuff you get so easy compared to C++ just leaves you wondering how you could ever program in C++ again), you know the stuff. These things are often far more of an issue than raw performance. Look at Slashdot, it's written in perl, presumably because they thought it was easier to write the website in, not because it was the fastest thing around.

    --
    dominionrd.blogspot.com - Restaurants on
  70. actually by _avs_007 · · Score: 1

    I agree. As much as I love Java, Swing is definately shit. Well, some of it anyways. Like JTree and JTable... They are very tedious and complex to use. The Tree and Table implementation in C# is much more logical and easier to use. And why is all of java pretty much synchronous, but the image processing stuff asynchronous? That's stupid. They recommend queueing up repaints every 100ms while you draw to the graphics object. But repaint calls update, which clears the graphics object. That means you have to draw the whole damn thing over again. And even if you fix that, what if you are painting in layers. Its screws everything up. So to solve that you use a MediaTracker and paint after the image is done loading. I've seen lots of other people's code, and they do the same... So with that being done, the whole thing might as well have been synchronous, and stick it on a different thread or something, and make it like almost everything else in Java.

    And someone earlier said Java network classes are nice... Java network classes suck even more than Swing does. What if I don't want to spawn a thread for fscking everything? What if I want to have access to lower level things that Berkely gives you? Tho, 1.4 may fix that. But what's up with the static cache in the InetAddress.GetByName???? That makes it absolutely worthless, as if you call it to get the IP before you dial-up (for example), then no matter what you do, it will always return 127.0.0.1, likewise if you do it after, then no matter how many times you hang-up re-dial, and get a new IP, it will return the same IP. Or if you are using wireless, and you go out of range and come back, etc etc. Of course, there are undocumented APIs, but relying on those is stupid.

    Anyways, I'm done ranting for now...

    1. Re:actually by gh · · Score: 1

      what's up with the static cache in the InetAddress.GetByName????

      This issue has been addressed years ago (where have you been?) by Sun for their implementation. There is a property, sun.net.inetaddr.ttl, for setting the value to something useful in dynamic situations such as 0 (i.e. never cache).

      The JDK 1.4 release also addresses the issue. From the candidate release notes:

      Prior to J2SE 1.4 if InetAddress.getByName if a lookup to the name service failed then all subsequent lookups of that hostname would fail for the lifetime of the virtual machine. This arose because negative lookups were always cached. This has changed in 1.4 so that by default if a lookup fails it's possible for a subsequent lookup to succeed. This is particularly important in dial-up environments or environments where the name service is not reliable.

      Lastly, InetAddress.getAllByName() apparently has never had these issues, but you will have to implement any round robin code yourself.

    2. Re:actually by portnoy · · Score: 1
      As much as I love Java, Swing is definately shit. [...] Like JTree and JTable... They are very tedious and complex to use.
      I disagree. JTree and JTable are really well-designed for the MVC paradigm, and you can subclass all the pieces more or less independently of each other. The more I work with them, the more impressed I am. Granted, the docs are mostly horrendous (and leads far too many people to shoehorn their data into a clunky DefaultTreeModel), but the design is far from shit.
    3. Re:actually by Golthar · · Score: 1

      Well, having worked on an alternative GUI system for underneat our own GUI components I noticed that the 100 ms repaint timer is a good thing.
      From what I have seen, you can get up to 5-10 repaints in very rapid sucession.
      The main point about it is that it resets the timer after every repaint is set.
      The effect is hardly noticable, but it sure saves resources.

      Also, why not asynchronous?
      If you override a component and put a call to its own repaint in the update code, then what?
      You get a stack overflow after a while?
      We use it pretty often in our animation code and it works allright.

      On another note, when you work at this level with the GUI, you will notice a lot of incosistancies between JVM's

    4. Re:actually by _avs_007 · · Score: 1

      Get all by name has the issues too. I wanted all the IPAddresses for a given NIC, but got killed by the static cache... If you have two NICS and have two IPAddresses, I want all of them. If I disconnect the cable on one or both, and then reconnect, I get new IPAddresses, but the JVM returns the OLD addresses.

      Also, in .net, the CLR is smart enough to know when you are querying for local IPAddresses, and WILL NOT build a DNS query. The JVMs are blind, and just issue a DNS for everything. And then they cache the responses...

      Also, I know about those properties you mention. The problem is nobody implemented them but SUN. Borland didn't, IBM didn't, etc etc. And you can be damn sure that the J2ME guys didn't, and the PersonalJava guys didn't. And even on Sun's own JDK, if you try to set those properties, it throws an exception saying you cannot make the cache more lenient. I know about setting the properties on startup, but I don't want to have to do that. I also don't want to be stuck using one company's JVM. If I were, I may as well not implement in Java, but a different language.

      And you mention negative caches. Thats totally irrelevent. Because lets say it does succeede when you connect the dial-up. The problem is with the POSITIVE CACHES, because when I disconnect, and reconnect later, or if I'm using wireless and go out of range and back in, I will get assigned a NEW address, but the damn static cache will return the OLD address.

      And I know the 1.4 addresses these issues. The main problem is the slowness that vendors take implementing new features. Just look at the current JVMs. Different vendors can barely keep up with 1.2 and 1.3, let alone 1.4 when it comes out.

    5. Re:actually by _avs_007 · · Score: 1

      I just meant that it was "over-architected". I didn't mean to say it wasn't flexible and such. Just that it didn't need to be so complex to be so flexible. Just look at the CLR implementation of a TreeView. It is much simpler, yet just as flexible. I like being able to access nodes as a collection, as an example.

    6. Re:actually by _avs_007 · · Score: 1

      I wasn't talking about repaint being asynchronous. I was talking about the Image loading classes.

      As for repaints in rapid succession. If I'm painting in layers, and update by default clears the graphics object, then it makes it redundant. I got around that by getting rid of the clear. That's not my main beef. Just that the whole system is built on a synchronous model, but then some things are asynchronous. I like the CLR better, in that everything is built on an asynchronous model, but you can choose to have things being synchronous, if you wanted...

  71. Some gcj facts by tromey · · Score: 3, Informative
    Some facts about gcj and the IBM article.
    • They tested an old version of gcj. gcj 3.1 beats the Sun and IBM JDKs on SciMark. It also wins on the "primes" test once you change it to use int and not long; this is a known gcc weakness.
    • In general we haven't done a lot of performance tuning. There is still a lot of room for us to improve.
    • You can see a much better (IMHO) comparison of gcj with other VMs here.
    • Contrary to what one poster said, my understanding is that gcj has better I/O performance than the Sun JDK.
    • It is true that gcj is missing AWT (though much progress has been made on that front recent, we still aren't there) and some other things. However, it is still useful for many things.
    1. Re:Some gcj facts by norwoodites · · Score: 0

      Mod this up because this is the main gcj guy who is dealing with the classpath merge.

    2. Re:Some gcj facts by Anonymous Coward · · Score: 0

      The parent post not being modded up reflects very poorly on the moderators.

      DO. YOUR. JOB. OR. GO. AWAY.

  72. One more rant :) by _avs_007 · · Score: 2, Informative

    Why is everything inconsistent?

    With Sun's latest JDK, behavior is different between Linux and Windows, despite it being the same version and from the same vendor.

    Example:

    Under windows: Component gets both Key and Mouse events, as well as repaints.

    Under linux: Component gets key event, but frame traps mouse event. And frame traps repaint as well.

    You would think they would have the same behavior... This really makes for write once, debug everywhere.

  73. Third that! by jonabbey · · Score: 2

    The biggest speed issues in Java are not from the JVM being an interpreter or JIT, they are from the API and the very high level of safety guarantees provided by Java.

    Java code can be very fast, but you have to take the API and the nature of Java into account in your design. If you want to do nothing but sling strings around, you're going to pay a massive penalty for doing it in Java, because all of the Java API's (at least in 1.3 and prior) require String objects for any string activity, and String objects are non-mutable due to a concern for thread safe API calls. If you want to change the third character in a String, you get to either create a new String with that change in place, or you get to create a StringBuffer class that will spew non-mutable String copies for each time you want to use the characters in your StringBuffer.

    A C program would never ever do things this way, and so you get insanely better performance. But if you write a C++ program that does do things this way, you'll actually get performance that is very close to Java's, except you have no guarantees as to the integrity of any of your objects because some random piece of code can scribble all over anything it wants to. Plus no universal set of exception classes that everything knows about, no portable thread synchronization primitives, etc., etc., etc.

    1. Re:Third that! by kzeddy · · Score: 1

      >But if you write a C++ program that does do things this way.
      good point except that if you are good C++ programmer you wouldn't write it exactly the same way.
      Writing C++ code doesn't mean that its automatically SLOW C code.
      Check out Effective C++ by forgot who. Gives great pointers on efficient C++ design.

    2. Re:Third that! by MuMart · · Score: 0

      Why don't you use a Java char array if you want to manipulate strings like you would in C?
      If you know how to optimize Java code it can be very efficient indeed.

  74. Different tools for different tasks by Roy+Ward · · Score: 4, Insightful

    I've used both C++ and Java extensively (although I haven't used garbage collected C++).

    For ease of coding, I find that Java simply outshines C++ because it doesn't leave me dealing with low level stuff, like pointers.

    An occasional big time-killer with C++ is trying to debug something that corrupts memory.This doesn't happen with Java (although you can muck up the synchronization with threading and get unpredictable results which is just about as bad).

    On the other hand, if I want performance (such as writing image processing software), I'll go with C++ (or assembler), as there is no way that Java can compete on speed for low level stuff.

    And even the awful C++ templates are better than no templates at all.

    1. Re:Different tools for different tasks by kzeddy · · Score: 1

      awful templates mean you used them for something that they shouldn't have been use for

    2. Re:Different tools for different tasks by kzeddy · · Score: 1

      this argument against C++ bc its to low level is a self inflicted argument. enforce a style and it won't happen. make sure that you are not breaking your own logic before you commit that code to the screen.INVARIANTS!!!!!!! Also a strong infrastructure for debugging (better logging of errors) can remove all of the hassle. if you write something in C++ that corrupts memory it means that same code written in Java would also somehow be flawed.

    3. Re:Different tools for different tasks by Malc · · Score: 2

      "An occasional big time-killer with C++ is trying to debug something that corrupts memory.This doesn't happen with Java (although you can muck up the synchronization with threading and get unpredictable results which is just about as bad)."

      Threading issues are no different in C++. In fact, they're probably worse in C++ because it could cause memory corruption and continue running only to crash much later.

    4. Re:Different tools for different tasks by Roy+Ward · · Score: 2

      > awful templates mean you used them for something that they shouldn't have been use for

      No, I mean that C++ has got the worst template system that I've seen anywhere - they look like they have been hacked on top of the C++ spec.

      I prefer to code (where possible) in really high level languages like Mercury ( http://www.cs.mu.oz.au/research/mercury/index.html ) where the equivalent of templates (although they don't call them that) is handled beautifully and fit with the rest of the language.

      It is possible to use the C++ templates nicely (and sometimes I do), but it doesn't stop them being ugly.

    5. Re:Different tools for different tasks by Roy+Ward · · Score: 2

      > enforce a style and it won't happen

      I've never seen a style that completely eliminates this without also destroying the power of the language, although I do use a style that prevents many of the problems.

      One thing that C++ has that Java doesn't (yet) is the 'assert' function. This on many occasions can make C++ easier to debug than the equivalent Java.

      > same code written in Java would also somehow be flawed.

      Yes, the same code written in Java would also be flawed, but the flaw is usually much easier to find, and sometimes even turns up at 'compile' time.

      Better (IMO) than either C++ or Java are some higher level languages that are likely not to even compile if there are flaws.

    6. Re:Different tools for different tasks by DaveWood · · Score: 2

      "One thing that C++ has that Java doesn't (yet) is the 'assert' function. This on many occasions can make C++ easier to debug than the equivalent Java."

      1.4 baby!

  75. Toshiba going mobile with ARM chip by ackthpt · · Score: 2, Informative

    No JVM for this baby.

    --

    A feeling of having made the same mistake before: Deja Foobar
  76. Javalobby? No thanks. by Anonymous Coward · · Score: 0

    I would rather listen to a series of speeches by Fidel Castro, Mulmar Quadaffi and Osama bin Laden than inhale that crap that passes as serious discussion on Javalobby. Typical Javalobby "discussion": "There (sic) gonna hurt Java!" or my favorite "How are we gonna get back at Microsoft for C#?".

  77. Re:Question for trolls by Anonymous Coward · · Score: 0

    That would be browsing at "+3" or more.

  78. Re:This isn't new! by Anonymous Coward · · Score: 0

    Whoops, the truth gets modded down again.

  79. Re:Java Question. - Some Answers by FastT · · Score: 4, Interesting
    The answers I typically get are not related to the programming *language* at all, but the organization and "java culture":
    But why does this invalidate the answers you get? Any language is equally as much a union of the language syntax itself and its built-in capabilities, i.e. its libraries. Your question is analogous to asking what is the advantage of English syntax over French syntax. In the broad scope of things, nothing really makes one better than the other--except perhaps their vocabularies.

    The richness of a language's vocabulary is what lets its speakers express themselves in powerful ways distinct from what other language speakers can do. French has a number of terms and concepts that don't have direct translations in English, and in fact, a huge amount of common English vocabulary comes from French.

    A programming language's libraries are equivalent to a natural language's vocabulary. And this is exactly where Java shines the most from an application development point of view. (It shines for other reasons on other fronts, like for embedded programming.)

    If you REALLY hated pointers that much you could write C++ code without pointers and write your own garbage collector (not to mention that LISP does garbage collection too -- nothing new).
    Sure, you can go out and develop a C++ app without using pointers, but that's just one app. The next one probably will use pointers. Even if I become a C++ programmer and refuse to use pointers in all my applications, I will have to work with someone who does, or use a library that requires them (is there one that doesn't?). And, eventually, I'll have to maintain someone's code that uses pointers. In the end, there's no getting away from it. Java eliminates the vulnerability pointers represent unilaterally, for better or worse.

    And similarly, you can go grab a library for doing garbage collection, but which one? You have nearly infinite choices, and every app will make a different choice. It's exactly the consistency of features that make Java superior in this regard. And when I say superior, I mean cheaper, and not just in terms of money, but in terms of resources. The support engineer trying to fix a bug in a Java program won't have any questions about the subtleties of a garbage collection API he's never seen, nor wonder what's in this odd little pointer that seems to keep causing a production crash. These are real advantages, even if they are hard to quantify.

    I haven't seen too many implementations when cross-platform is needed at run-time
    That's just the limit of your experience then. My experience is exactly the opposite. The advantage here is the fact that you maintain a single codebase--the same source files--for all platforms, and they do work as advertised minus any VM bugs (which are fairly rare compared to application bugs).

    Let me tell you a story. I used to work for one of the real success stories of the dot-com era. My company implemented different pieces of its product using Java and C++, and these pieces used CORBA to interoperate. As far as any one distributed object was concerned, the object on the other end could be any language; it was only a difference of implementation.

    Anyway, the support and maintenance costs for the Java portion of the product were dramatically lower than for the C++ portions. They both used the same infrastructure, but one was cheaper and faster to develop in, easier to fix and enhance for the next version, easier to debug both in-house and in the field, and more stable to boot. Add to this the fact that you only had one copy of the source files for the Java portions, versus the several versions for all the different platforms we supported in C++. In the end, if you work on large, complex software systems, Java is vastly easier to maintain, and vastly cheaper to support. Ask any of the product engineers and they would say the same thing: Java is just more pleasant and productive to work in, and they prefer Java over C++. They all hated the C++ portions of the product, and regretted ever putting them in.

    And, sadly, most programmers out there aren't that good. With C++, you give them a loaded weapon and tell them to be careful. As often as not, they inadvertantly shoot you or themselves. At least with Java, poor programmers have to load the gun before they can shoot anyone. Sorry for the extended analogy.

    You know the platform of your server (it won't randomly change without you knowing) so why not write in a higher-level language such as C++ and skip all the platform-dependant code (or do ifdefs) and have it run natively faster? If your platform changes you just re-compile
    Ugh, so much to say here. The problem is that what you are suggesting is a myth; it does not represent the real world of enterprise application development. You don't know your platform, it is not a constant in the equation. You want to provide for all platforms if you're a software vendor. Once you can sell to one, using Java, you can sell to all others without any significant extra effort. Furthermore, bugs fixed in one version of your code are fixed in all versions--support costs go down dramatically.

    If you're a client, you may find that you are grossly unsatisified with vendor X's hardware/support/performance and want to switch to using a solution by vendor Y (and this happens all the time in the corporate environment). What do you do now? Just because you know things are changing doesn't make the cost of changing any less. However, the fact that you wrote your application in Java does make the cost less--it makes it nil, because the same code runs on HP, Solaris, Intel, Windows, Linux, MacOS, AS/400, etc. The ability to move code effortlessly between platforms allows you as a company to save costs if it makes sense to switch hardware platforms, or mix and match platforms.

    "Java has a cross-platform GUI". So is GTK and QT.
    Yes, but the application code your GUI fronts is also cross-platform. Not so with the others. And again, there's the benefit of the single binary versus a binary per platform.
    "Java is easy to learn". I'll skip that.
    That's fine, but it really is. Try it. The limited complexity of the language lets programmers focus on the task at hand far more easily in my experience, and it's much easier to do OO in Java than in C++. This means all the benefits of OO are more easily achievable (and if you don't think OO is a good thing, don't bother talking to me.)
    Why program in Java when you can achieve the same result faster in another language?
    If you can, great, but I haven't found that language yet. It might be Smalltalk, or Perl, or COBOL, but nothing so far has taken all the great ideas from all of these languages and made them so eminently useful and practical. For example, Smalltalk is probably the most elegant, most forward-thinking languages around (even today), with tons of powerful features. However, it doesn't have the network orientation that Java does, or the C/C++ like syntax that makes it easy for developers to learn. It doesn't have the ability to be pared down and run inside a DIMM-sized computer, or be as dynamic as Java.

    I'm not advocating Java over other languages if those languages are more suited to the job. I'm not going to write a device driver in Java. I'm suggesting that a task that can be equally accomplished in Java and some other language will be more maintainable, cost less to support, and completed more quickly, when written in Java. The real-world merits of Java are that it reduces resource costs for anyone using it, end of story.

    --

    The only certainty is entropy.
  80. Re:Oh, it's there, alright (to interpret or not?) by Anonymous Coward · · Score: 0

    "runtime" ? You mean "compiled VB6 apps" are native 386 executables?

    A few days ago, I had a little problem with this vb6 thing.
    I wrote an expression like this :

    IF i>=0 AND x(i)7 THEN ...

    The trick here is that the second term is not evaluatable at all if the first one is false (typical C/C++/Java/C# code).

    Guess what? Your nice vb6 "runtime" evaluates the whole expression! Exactly like EXCEL or any programmable calculator! It took me more than a hour to find the problem in my code!
    This is typical of an INTERPRETER that keeps an expression as a tree of terms in memory, and has no choice but evaluate the whole thing. Real compilation leads to generate code that computes the expression, so that a branch of it can be skipped, like in the above example. Even Java does this right.

    How come C# and "vbnet" have no such problems? Is it a real "runtime" now at last?

  81. 100% right! by GCP · · Score: 4, Insightful

    Sun pushed *binary* compatibility so hard because Java's claim to fame was taking what loaded into your browser from static content to full executable apps -- making the underlying OS irrelevant in the process. "Death to Windows!"

    It didn't work out. Client side Java is essentially dead. "Death to Java applets!" C#/.Net will become what Java only dreamed it could be -- but, sadly, only on Windows.

    In the meantime, Java hit pay dirt on the server, because the language is so easy and productive to work in and the result is so portable.

    Source portability would have been sufficient on the server, though. I can't prove it, but I strongly suspect they could have created a better server-side programming language if they had designed for 100% *source* portability, then instead of constraining themselves to binary portability and security sufficient for running *anybody's* binaries on *anybody's* client, had instead optimized for high performance plus ease of rapid, bug-free development -- more like Eiffel.

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
  82. Re:either embed the jvm or the compiler - you choo by wheany · · Score: 1
    Or perhaps it's just language l33t1sm.
    It's language l33t1sm. You know Perl and C++ are l33t. Java's image is about the same as Visual Basic's. No real programmer would ever use such toy-language. C++ and Perl are geek languages, while Java and VB are corporate "suit" languages.
  83. Operator overload is useful by Anonymous Coward · · Score: 0

    For example in C/Java I have:

    if (FixedLess(FixedAdd(FixedCreate(1.0), foo), FixedMult(FixedCreate(2.5), bar))
    which in C++ would be

    if (1+foo Fixed(2.5)*bar)

    which is much easier to write and understand. If you sausage your code by calling things stupid names then what do you expect?

    1. Re:Operator overload is useful by Anonymous Coward · · Score: 0

      Uh, IMHO, neither of those statements are particularly readable.

      -Chris

    2. Re:Operator overload is useful by Anonymous Coward · · Score: 0

      Well /. did remove the < symbol in the last line, but I find maths symbols like + and < easier to use than Java/COBOL's way of spelling them out in english.

  84. Re:Oh, it's there, alright (to interpret or not?) by The_Fire_Horse · · Score: 0

    Well, maybe if you programmed safely you wouldn't have these problems.

    I mean - why the hell are you programming in VB6 if you dont know what you're doing ?

    It reminds me of that oldsaying.... something about a shoddy craftsman blaming his tools...

  85. Welcome to FDPR by tjwhaynes · · Score: 2

    Some VM implementations use a sophisticated comprimize between interpreters and JIT compilers [sun.com]. If you can identify the small part of the program that does most of the actual work, you know what parts of the program really need to be compiled. How do you do this? You wait until the program actually starts running!

    Advocates of this approach claim that it has the potential to be faster than C++ and other native-code languages. A traditional optimizing compiler can only make decisions based on general predictions as to how the program will behave at run time. But if you watch the program's behavior, you have specific knowledge of what needs to be optimized.

    Err - but you can do that with C++. Ever heard of Feedback Directed Program Restructuring (FDPR)? You run your code under whatever load you feel like optimizing and use the FDPR tools to rebuild the code, changing the ordering and ensuring that cache misses are minimized as much as possible. Try taking a look here for some more details.

    Cheers,

    Toby Haynes

    --
    Anything I post is strictly my own thoughts and doesn't necessarily have anything to do with the opinions of IBM.
    1. Re:Welcome to FDPR by CFN · · Score: 1

      I think you are missing the point.

      A FDPR compiler will use the behavior of a previous run (or runs) to optimize the code for the next run, where as a profiling JIT can use the behavior of the current run to optimize the current run: if the JIT notices that you are repeatedly calling a certain function, it can decided to optimize that function the next time it is called.

      A FDPR will work fine for a large numerical application, where almost all runs follow the same control path, but for an interactive application, where every run will have a different control flow, these profiling JIT appear to have an advantage.

    2. Re:Welcome to FDPR by egeorge · · Score: 2, Interesting
      Err - but you can do that with C++. Ever heard of Feedback Directed Program Restructuring (FDPR)? You run your code under whatever load you feel like optimizing and use the FDPR tools to rebuild the code, changing the ordering and ensuring that cache misses are minimized as much as possible.

      There is one thing wrong with this process; rebuild. The latest generation of Java dynamic compilation/optimization does its work behind the scenes and happens automatically which I think is a huge advantage over FDPR. It allows the optimizer to adapt to unforseen changes in the production environment.

      I think that Hotspot-style dynamic optimization is the future of Java and will eventually overtake statically compiled (or repeatedly compiled) options.

      However, Hotspot has a lot to learn from FDPR, like how to keep track of performance metrics across VM sessions. The biggest drawback of current Java dynamic optimizers is that you only get their full potential for long-running processes. Once they get optimization profile management down, the dynamic optimizers like Hotspot are going to look much more appealing on the types of benchmarks like this article uses.

    3. Re:Welcome to FDPR by dkixk · · Score: 1
      There is one thing wrong with this process; rebuild. The latest generation of Java dynamic compilation/optimization does its work behind the scenes and happens automatically which I think is a huge advantage over FDPR. It allows the optimizer to adapt to unforseen changes in the production environment.

      Of course, in general, one should optimize for the normal case; i.e. forseen conditions. I would imagine that in most cases an optimization for a normal case would be a pessimization for unforseen cases and vica versa. In other words, optimizing execution for unusual cases would tend to slow down the usual case(s). Also, I don't think that there is anything built into the C/C++ standards that would disallow dynamic feedback from the runtime environment. For example, malloc/::operator new could very well track runtime memory characteristics in its implementation.

      However, C/C++ probably do not have many implementations like this because, in practice, the performance of C/C++ programs has not needed this kind of improvement. Java, on the other hand, is new to the game and has certain language features (required array bounds checking) that trade performance for run-time safety which force it to find other ways to get performance improvements. Pure conjecture on my part, though.

      Anyway, I continue to think that any/most of the good stuff in Java has been in Lisp for ages and that Lisp tends to do it better, including performance.

    4. Re:Welcome to FDPR by Anonymous Coward · · Score: 0

      "There is one thing wrong with this process; rebuild. The latest generation of Java dynamic compilation/optimization does its work behind the scenes and happens automatically which I think is a huge advantage over FDPR."

      I don't think that dynamic optimization can be so easily characterized as "advantaged" over static optimization. Both have their advantages. Microsoft recognizes this and implements both in their Vulcan project.

      It is also not an apples to apples comparison when comparing an interpreted -> native code optimization (JIT) vs. a native code to native code optimization (FDPR).

    5. Re:Welcome to FDPR by egeorge · · Score: 1
      Java, on the other hand, is new to the game and has certain language features (required array bounds checking) that trade performance for run-time safety which force it to find other ways to get performance improvements.

      This is certainly the case. I (like many other heavy Java users) tend to think that for most cases the tradoff between performance and bug-reducing language features is a worthwhile trade. Of course it always depends on what problems your are trying to solve.

      Anyway, I continue to think that any/most of the good stuff in Java has been in Lisp for ages and that Lisp tends to do it better, including performance.

      Actually, I think that the best stuff from Lisp is conspicously absent from Java. Perl and Python seem to me to be the inheritors of the really good bits from Lisp.

    6. Re:Welcome to FDPR by egeorge · · Score: 1
      I don't think that dynamic optimization can be so easily characterized as "advantaged" over static optimization. Both have their advantages. Microsoft recognizes this and implements both in their Vulcan project.

      Definitely both types of optimization provide different benefits. I would never want a world without static optimizers. Dynamic optimization is relatively new and I think we have yet to see what it is really good at.

      It is also not an apples to apples comparison when comparing an interpreted -> native code optimization (JIT) vs. a native code to native code optimization (FDPR).

      This is true. The virtual machine oriented dynamic optimizers have farther to go on the optimization front, but are much better at thefeedback-loop aspects. I think eventually the two efforts will meet in the middle. C++ environments will become more "virtualized" with garbage collectors and runtime profilers, while existing virtual environments (like Java) will become more "static" with JITs and native compilers. The (oft abhorred) C# is a good example of this convergence.

  86. If HotSpot is so great... by rexguo · · Score: 1

    Why doesn't HotSpot have a bin dump of its 'insanely' optimized native code? This way, you have a small and fast native app, and a smaller 'JVM' footprint that supplies the rest of the stuff you don't want natively compiled (like GC thread etc.) Unless I miss something, I'm sure this is technologically achievable on Sun's part, but they're not doing it for political reasons. Do people remember the days of JavaOS and Java chip? When the JVM is part of the OS, you can't call it 'virtual' anymore, and this subtle difference has a psychological effect on people so they will stop complaining about the JRE footprint etc: the JVM process is officially now part of the group of system kernel processes. So then JavaOS becomes a platform by itself and who knows if it will be compatible with any other platforms out there, especially if it starts to gain a significant market share. Just face it: IT business is 99% about market share and locking users in.

    --
    www.rexguo.com - Technologist + Designer
  87. Re:Oh, it's there, alright (to interpret or not?) by Anonymous Coward · · Score: 0

    .
    Sorry but, I would like NOT TO touch this vb6 thing!!! Unfortunately, I *have* to touch it from time to time in my job ("programming" is a word I would personnaly never use when refering to vb6) when our local VB expert is on holydays! :-(

    Besides, my remark was not about my personal problems or my dangerous coding style! It was about whether or not VB*DLL contained an interpreter, or a modern Virtual Machine ("runtime").

    I think my little incident with interpreted expression evaluation was perfectly demonstrative about that. There must be millions of other details like this one, that I obviously don't know (and don't want to) regarding what vb6 was and was not.

    And, please, start thanking MS Management for giving you the net/sharp Virtual Machine, so that dangerous people like me can stop blaming their tool ! :-)

  88. Cobol rates are even higher by Ars-Fartsica · · Score: 2

    So why aren't you switching? Rates go up as the number of practitioners in the field drops - usually as a result of reduced demand. The last man standing in the C++ practioner market will be a happy camper, but this doesn't indicate a success for the language.

    1. Re:Cobol rates are even higher by Anonymous Coward · · Score: 0

      And while all you losers are sitting there arguing about your mad coding skillz, I'll be telling you WTF to write, cause I pride myself on being a god damned Software Engineer/Architect. Language Implementation is the trivial aspect of software development. It's the same as the Ford vs. Chevy bullshit - Calvin pissing on the logos. You still need a freaking car, and you still gotta know how to drive well if you want to win any contest. "I'm a race car driver, but I only can drive the Malibu". Bah.

  89. I think they should have added... by CTho9305 · · Score: 1

    A comparison with C/C++ compiled by gcc. At least for the prime factorization, changing the code from java to C would have been trivial, and would also show any discrepancies between natively-compile java vs. compiled C.

  90. Windows plug? by Anonymous Coward · · Score: 0

    > If your programming mucks up, the wrong people
    > DIE. If you don't have standards that are
    > _rigorously_ abided by, our soldiers DIE.

    Ah, a convincing argument for Windows deployment
    by the US military. And so eloquently put!

    1. Re:Windows plug? by Anonymous Coward · · Score: 0

      umm no. he forgot iron stability. stability for running word apps is not the same

  91. Re:either embed the jvm or the compiler - you choo by tulare · · Score: 2

    Bah. My beef with java is and always has been that it is slow, buggy, and produces a reliably ugly GUI when you need to create one. It really doesn't matter which platform, either. Apple used to do this advertising (you will laugh) which said "See java run - quickly!" Guess which OS? If you guessed X, you're right. The fact is that for whatever reason (I admit ignorance - I don't know!), Java is slower than other languages. I have been watching this thread, and it is interesting to see the arguments re: automatic garbage collection versus manual cleanup.
    My >guess is that the reason most Java apps run so slowly is because the language is structured in such a way that it is easy to write sloppy code. For example, why bother figuring out which specific library to call up when you can just call java.lang.* in your file. In that sense, I guess I am guilty as charged. The second biggest reason most people poo poo Visual Basic is that it lets people get awaw with writing shitty code. Same with Java.

    --
    political_news.c: warning: comparison is always true due to limited range of data type
  92. Java is not God by fm6 · · Score: 2
    Hey, I was just parroting the VM engineers. I'm not qualified to compare their approach with alternatives.

    Obviously Java has not turned out to be the universal solution that it was supposed to be. Of course there are non-Java solutions for some problems that are objectively better, or at least preferrable to the developers that employ them.

    The purpose of my rant was not to advocate Java in general, or any particular approach to it. (In point of fact, I haven't worked with Java for over 3 years. As I said, I'm no expert, and it doesn't suprise me that people find flaws in my summary of the VM issue.) I was merely pointing out that the naiveness of the VM-versus-Native dichotomy.

  93. Well, then... by devphil · · Score: 2
    I find that Java simply outshines C++ because it doesn't leave me dealing with low level stuff, like pointers.

    Then perhaps you should learn how to use C++.

    Not to flame you -- I'm usually the first person to use the right-tools-right-job argument -- but one of the best books to teach C++ doesn't even mention pointers or builtin arrays until chapter 10. They teach C++, not C features that happen to show up in C++.

    After having used C++ quite heavily for a decade, even I found parts of this book refreshing. I highly recommend it, both to beginning programmers, and crusty veterans like us.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
    1. Re:Well, then... by Malc · · Score: 1

      I haven't read the book. But, in my experience, the use of STL helps erradicate the most common uses of pointers.

  94. Re:either embed the jvm or the compiler - you choo by Anonymous Coward · · Score: 0

    For example, why bother figuring out which specific library to call up when you can just call java.lang.* in your file

    erm, you're a dumbass, get a life and stop trolling and go gain some education, every _normal_ programmer knows that importing a whole library doesn't change a thing, when it's compiled, it always has absolute class references.

    IMO, Perl is the one that allows to write sloppy code with undeclared variables and cryptic syntax

  95. Re:either embed the jvm or the compiler - you choo by tulare · · Score: 2

    "when it's compiled"
    And I suppose the compiler doesn't need any resources to run? So who's the dumbass? BTW, post with your logon if you want to namecall.

    --
    political_news.c: warning: comparison is always true due to limited range of data type
  96. Re:either embed the jvm or the compiler - you choo by civilizedINTENSITY · · Score: 1

    Python (and eLisp too, for that matter) both have bytecode compilers. Don't know nothin' 'bout perl.

  97. Write Once, Run Anywhere by ansible · · Score: 2

    I tend to sympathize with the write-once-run-anywhere (WORA) advocates.

    I haven't seen single cross-platform programming language that didn't have some platform-specific idiosyncrasies. You either have to avoid those areas completely, or try to code around them.

    If you need those features, then you have to fix things for the specific platform at either compile-time or run-time. Compile-time means some kind of hack like the C pre-processor. Run-time means dynamically loading the correct version of some class. Either way, I say: "Ugh." That's not to say that either approach won't work, but it isn't as pleasant.

    It keeps things simplier and saner when you're just targeting the same VM and standard libraries. You still have to have a bunch of conformance tests to make sure the particular JVM is compliant, but that's easier to maintain than platform-specific code in every application you write.

    I've been doing mostly Java programming for the last couple months, and while there are a number of features in the language that annoy me, the overall development process is more pleasant than in other environments.

  98. native Java would be neat? by MemeRot · · Score: 1

    Seems to me that native Java would be virtually indistinguishable from native C++.

    I can't believe how much Java has backed away from its cross-platform emphasis. Oh ok, let's make Jini for when you want to use Jave but need it in this special platform. And why not let you comile to a native binary? Sheesh... not much Java left.

    1. Re:native Java would be neat? by -brazil- · · Score: 1
      Oh ok, let's make Jini for when you
      want to use Jave but need it in this special platform.


      That's JNI, not Jini. Jini is a framework for auto-discovery of network services, comparable to a CORBA ORB.
      JNI (Java Native Interface) is a standardized interface to allow Java to call procedures written in other languages; doesn't really have to do much with platforms, either.

      --

      The illegal we do immediately. The unconstitutional takes a little longer.
      --Henry Kissinger

  99. That's the worst argument I've ever heard by MemeRot · · Score: 2

    You can do the same thing with C or C++. Or ANY language that you can compile. If Java compiled separately for each different platform is 'cross-platform' then so is C++. This DOES eliminate cross-platform as a benefit. And confirms the point that if you have a large, slow Java application where the speed is a serious problem, you should have written it in C++ in the first place.

    1. Re:That's the worst argument I've ever heard by ahde · · Score: 1

      java only runs on one platform -- the java virtual machine. The jvm has to be ported (in native code) to other platforms. The only advantage of Java is the huge number of well designed (and documented) class libraries. By making java compile to native code, it only makes it more portable.

  100. Why would the disk space requirements go up? by Anonymous Coward · · Score: 0
    Why can't the common classes go into shared objects that are compiled natively? (Heck, they just might be that already!)

    PS - Your definition of "toy code" applies to anything other than an operating system....

  101. No, wrong architecture by GCP · · Score: 2

    If your fridge asks the printer to print something, then status messages for that print job will be returned to the requester automatically. If the fridge has any message display mechanism, it can decide to display the messages. Or it can ignore them. What the fridge does with its messages isn't the printer's concern.

    The printer and the fridge have no need to reprogram each other. They just need to send messages in standard formats appropriate for the class of device: a printer or a fridge.

    Java was designed to run on general-purpose clients, and it's only there that the idea of sending executable code makes more sense than sending remote API calls. I think that will mostly mean clients with browsers, and I expect .Net to become more successful at this than Java due to MS's dominance of this type of client.

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
    1. Re:No, wrong architecture by Anonymous Coward · · Score: 0

      fair enough, it just means that fridges and printers have to know each other's protocols - which they would have to to some degree (ie the fridge knowing the existence of the org.jini.whatever.Printer interface).

      but what I like about Jini is its encapsulation behind the interface - should "Remote fax not answering" be part of the Printer interface (if the printer implementation is actually a fax masquerading as a printer)? probably not. but if it isn't, it would still be nice if the fridge could display fax-specific responses to that particular error.

      Basically, I really like Jini and especially the ServiceUI project and think it could be really useful. Those people who say cross-platform binary compatability isn't needed are thinking of present day computers and usage, and not looking ahead to what COULD be. And sometimes that annoys me!

      PS: just rereading what I've written above, this is a perfect case for a ServiceUI - setPhoneNumber(...) shouldn't be part of a Printer interface, but it would be needed for a Fax pretending to be a printer ... the fridge doesn't know that a phone number is required, but a fax-specific ServiceUI could ask the user for it, with all those details completely hidden from the fridge.

      PPS: That's two posts in two days now - I'm getting myself an account!

  102. Re:either embed the jvm or the compiler - you choo by osu-neko · · Score: 1

    Actually, you've hit the nail on the head without realizing it. Java, like Perl, is a wonderful scripting langauge, and things like Perl are exactly the kinds of things it should be compared with. It's talk as if Java were in the same category as C or C++ that rankles everyone. If Sun wants to push Java as a much better alternative to Perl, I think people would be less rankled than when Sun acts like Java is the C++ killer or some such nonsense...

    --
    "Convictions are more dangerous enemies of truth than lies."
  103. Re:either embed the jvm or the compiler - you choo by osu-neko · · Score: 1
    I believe Perl uses JIT-style compilation (it compiles your program in memory before it executes it).

    <sigh> Like it took me two minutes to type that... (silly slashcode...)

    --
    "Convictions are more dangerous enemies of truth than lies."
  104. Re:Oh, it's there, alright (to interpret or not?) by tomhudson · · Score: 1

    runtimes and interpreters are not virtual machines. A virtual machine includes pseudo-registers, a stack pointer, etc. This is as opposed to runtime libraries, which are not interpreters, but binary code your app can be linked against, and which you can call the various functions.

    Squishing an interpreter and its' script into an 'exectuable' is an old trick:
    dBase executables, dbFast executables, vb executables, etc. Their idea of 'linking' is not the same as a true compiled language.

    The idea of pcode was actually started a couple of decades ago with pascal pseudo-compilers, which compiled down to byte-code which could be interpreted by the run-time quicker. Now, of course, pascal compiles to object code (and you can do the same w. basic - remember Turbo Basic). The true test is if other languages can link against your object files.

    Just a bit of history, for what it's Wirth (pun intended) (re Nicholas Wirth, so I don't get fl*med for spelling).

  105. what's left by poemofatic · · Score: 2

    is still a language that's much easier/quicker to code in than C++,

    and that has all the portability of the old Java, in addition to this (still vaporware) extra feature.

    --

    When in doubt, have a man come through a door with a gun in his hand.

  106. 64-bit integer math in FPU registers by Animats · · Score: 2
    x86 FPUs, all the way back to the 8087, have internally a 64-bit mantissa and a 16-bit exponent. IEEE floating point is integer-preserving if the numbers will fit. And the x86 FPU has instructions like FILD and FISTP, which load and store 64-bit integers to and from the FPU, converting them to 16/64 extended format.

    64-bit add, subtract, and multiply work fine if the numbers fit in integers. Overflows on conversion back to integer cause an invalid-arithmetic-operand FPU exception, which Java can use but C has no idea what to do with. So that's fine.

    Divide and mod are tougher to do as integer operations in the FPU, because fractional results appear in the FPU registers, but it's possible if the rounding modes are set to "round down". Note that the benchmark used "%", and it's possible that GCC doesn't try to do 64-bit "%" (which, after all, isn't used much) in the FPU.

  107. Thank You. by cgleba · · Score: 2

    Thank you all for the informed replies and the anecdotes. I have a better outlook on Java now and understand better where it is best suited.

    I think most of my 'questioning' Java has come from people who try to 'sell' Java as a panacea -- aka 'putting Java in light bulbs', "re-writing OS kernels in Java', etc.

    What you mantioned is the clearest and best answer that I've hear for the reasons to use Java thus far -- aka you *can* do it in another language, but the support costs and development time for Java is a lot smaller. That makes sense and in that case the main costs to weigh when choosing Java over another language is what it will cost in developer/support time versus the performance losses.

    Thank you for your answers, even though my question did get modded into oblivion :).