This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: java.io.PrintStream


Hi,

On Tue, 2003-06-17 at 17:12, Michael Koch wrote:

        +       * java/io/PrintStream.java
        +       (lineSeparator): New static member variable.
        
BufferedWriter always requests System.getProperty("line.separator") when
needed. But since PrintWriter also already has such a static field so I
guess that caching this value is OK. If so, then maybe BufferedWriter,
PrintWriter and PrintStream could share a package private static field
to store this value?
        
        +       (print): Call print(String) instead of direct print method of the
        +       Writer Object.
        +       (println): Call println(String) instead of direct println method of the
        +       Writer Object.

This seems to be slow in the case when you already have a char[]. In
that case you first create a new String object (that makes a copy of the
whole char[]) and then you finally end up in Writer.write(String) that
(see comment) turns the String into a new copy of the char array. That
seems a bit much overhead.

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]