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

CSS StyleManager has poor performance due to unbuffered input stream

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 8, openjfx11, openjfx16
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:

      Description

      The StyleManager::calculateCheckSum method calculates a checksum using a MessageDigest read from an InputStream obtained from the URL of the stylesheet. The problem is that it reads bytes from the stream one byte at a time without wrapping the InputStream in a BufferedStream:

                      try (final InputStream stream = url.openStream();
                          final DigestInputStream dis = new DigestInputStream(stream, MessageDigest.getInstance("MD5")); ) {
                          dis.getMessageDigest().reset();
                          while (dis.read() != -1) { /* empty loop body is intentional */ }
                          return dis.getMessageDigest().digest();
                      }

      It should either wrap the original stream in a BufferedInputStream or else read an array of, say 4K, bytes using the read(byte[]) method. The latter approach is used by the NativeLibLoader::cacheLibrary method.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              arapte Ambarish Rapte
              Reporter:
              kcr Kevin Rushforth
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: