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

RandomAccessFile.writeBytes(String) is woefully ineffecient

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.1.3
    • Fix Version/s: 1.1.6
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      1.1.6
    • CPU:
      sparc
    • OS:
      solaris_2.5.1
    • Verification:
      Verified

      Backports

        Description

        RandomAccessFile.writeBytes(String) takes a string out writes it out in
        bytes. What it neglects to say is it will write each byte out one-by-one.
        This caused a performance problem on our machine. Its better to generate
        your own byte array from string and then use RandomAccessFile.write(bytebuffer)

        Some example truss output

        23173: read(8, "CAFEBABE\003\0 -\094\b\0".., 3203) = 3203
        23173: brk(0x001749E8) = 0
        23173: brk(0x001769E8) = 0
        23173: write(17, " R", 1) = 1
        23173: write(17, " e", 1) = 1
        23173: write(17, " p", 1) = 1
        23173: write(17, " l", 1) = 1
        23173: write(17, " i", 1) = 1
        23173: write(17, " e", 1) = 1
        23173: write(17, " d", 1) = 1
        23173: write(17, " :", 1) = 1
        23173: write(17, " ", 1) = 1

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                dviswanasunw Deepa Viswanathan (Inactive)
                Reporter:
                caustinsunw Calvin Austin (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: