RandomAccessFile.writeBytes(String) is woefully ineffecient

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 1.1.6
    • Affects Version/s: 1.1.3
    • Component/s: core-libs
    • None
    • 1.1.6
    • sparc
    • solaris_2.5.1
    • Verified

        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

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

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: