Why Java is so slow?

From: <- Chameleon -> (cham_gss_at_hotmail.NOSPAM.com)
Date: 07/30/04


Date: Fri, 30 Jul 2004 19:28:59 +0300

I have about 2600 lines of this type inside a text file:
----------------------
20/11/1980/My birth!
31/12/2003/A day before this year.
30/07/2004/A Boring Day!
etc
----------------------

These lines describe historical anniversaries.
I have a web page (PHP) with this theme, and I want to create a Java
application for this (stand-alone).

The problem is this:
PHP wants 0,3 seconds to create an HTML with ALL these lines (all of
2600!!!)
BUT in the same machine Java wants 2 minutes!!!!

So, Why Java is so SLOOOOOW?

I see that: Java adds to output String, first 240 lines in about 3 seconds.
I believe there is a problem with reallocation of String.

Because the String (in worst case) is about 800 KBs long, Can I set an
initial size for String?



Relevant Pages

  • Re: Help me!! Why java is so popular
    ... String or StringBuffer? ... keep in mind I knew NOTHING about Java. ... The language accepted it, no warnings, and thus I ... in some native assemblers you can peruse the instruction ...
    (comp.lang.java.programmer)
  • Re: question about assigning null to a reference object
    ... String getAuthor() ... void setAuthor ... b.setTitle("Thinking in Java 4th Edition"); ...
    (comp.lang.java.help)
  • Re: Java questions: Urgent
    ... why I would expect almost any Java programmer to be able to answer ... Which is the main reason I "butted" in a bit.. ... on the characters in the String. ... > therefore naturally cover all the basics, or they have missed out badly ...
    (comp.lang.java.programmer)
  • Re: A C++ Whishlist
    ... with the C++ string classes as compared with the Java ones. ... You can keep you structs entirely ... The simple separation of interface and implementation that header files ...
    (comp.lang.cpp)
  • Re: Using Cobol when writing CGIs for the OSU web server.
    ... string safe as well as make slow conversion (as bugs are found and ... The string type approach. ... Because no one has bothered to add it to the "offending" language. ... Java is certainly no replacement for C. ...
    (comp.os.vms)