[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath: Performance improvements for BufferedReader

Kaffe CVS cvs-commits at kaffe.org
Wed Feb 25 12:11:05 PST 2004


PatchSet 4463 
Date: 2004/02/25 19:28:24
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: Performance improvements for BufferedReader

2004-02-24  Dalibor Topic <robilad at kaffe.org>

        Resynced with GNU Classpath

        2004-02-06  Mohan Embar  <gnustuff at thisiscool.com>

        * java/io/BufferedReader.java (sbuf): New field.
        (readLine): Use String.valueOf instead of new String() as per
        Per Bothner's suggestion. Use instance sbuf field instead of a
        local StringBuffer instance.

Members: 
	ChangeLog:1.2043->1.2044 
	libraries/javalib/java/io/BufferedReader.java:1.13->1.14 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2043 kaffe/ChangeLog:1.2044
--- kaffe/ChangeLog:1.2043	Wed Feb 25 19:09:58 2004
+++ kaffe/ChangeLog	Wed Feb 25 19:28:24 2004
@@ -2,6 +2,17 @@
 
         Resynced with GNU Classpath
 
+	2004-02-06  Mohan Embar  <gnustuff at thisiscool.com>
+
+        * java/io/BufferedReader.java (sbuf): New field.
+        (readLine): Use String.valueOf instead of new String() as per
+        Per Bothner's suggestion. Use instance sbuf field instead of a
+        local StringBuffer instance.
+
+2004-02-24  Dalibor Topic <robilad at kaffe.org>
+
+        Resynced with GNU Classpath
+
 	2004-02-05  Olga Rodimina <rodimina at redhat.com>
 
         * java/awt/geom/AffineTransform.java:
Index: kaffe/libraries/javalib/java/io/BufferedReader.java
diff -u kaffe/libraries/javalib/java/io/BufferedReader.java:1.13 kaffe/libraries/javalib/java/io/BufferedReader.java:1.14
--- kaffe/libraries/javalib/java/io/BufferedReader.java:1.13	Mon Dec 29 11:15:17 2003
+++ kaffe/libraries/javalib/java/io/BufferedReader.java	Wed Feb 25 19:28:26 2004
@@ -1,5 +1,5 @@
 /* BufferedReader.java
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
      Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
@@ -89,6 +89,11 @@
   static final int DEFAULT_BUFFER_SIZE = 8192;
 
   /**
+   * The line buffer for <code>readLine</code>.
+   */
+  private StringBuffer sbuf = null;
+
+  /**
     * Create a new <code>BufferedReader</code> that will read from the 
     * specified subordinate stream with a default buffer size of 8192 chars.
     *
@@ -439,7 +444,7 @@
     int i = lineEnd(limit);
     if (i < limit)
       {
-	String str = new String(buffer, pos, i - pos);
+	String str = String.valueOf(buffer, pos, i - pos);
 	pos = i + 1;
 	// If the last char in the buffer is a '\r', we must remember
 	// to check if the next char to be read after the buffer is refilled
@@ -450,7 +455,10 @@
 	    pos++;
 	return str;
       }
-    StringBuffer sbuf = new StringBuffer(200);
+    if (sbuf == null)
+      sbuf = new StringBuffer(200);
+    else
+      sbuf.setLength(0);
     sbuf.append(buffer, pos, i - pos);
     pos = i;
     // We only want to return null when no characters were read before




More information about the kaffe mailing list