Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4350734

PrintWriter.print (char c) is very slow.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 1.4.0
    • 1.3.0
    • core-libs
    • beta
    • generic
    • generic



      Name: skT45625 Date: 07/05/2000


      java version "1.2.2"
      Classic VM (build 1.2.2-L, green threads, javacomp)

      print is implemented as:

      class PrintWriter {
      ...

          public void print(char c) {
      write(String.valueOf(c));
          }

      Which creates a temporary java.lang.String and a char[] for every character
      output. This dramatically slows output though a PrintWriter. The following
      alternative implementation is equivalent and much faster:

          public void print (char c) {
              write (c);
          }
      (Review ID: 106880)
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            skondamasunw Suresh Kondamareddy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: