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

AES microbenchmark unnecessarily allocates memory

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: performance
    • Labels:
      None

      Description

      The AES microbenchmark in openjdk/bench/javax/crypto/AES.java tests the performance on Cipher.doFinal(byte[]). This method allocates an array and returns it. AES is very fast due to the use of specialized instructions, and so the time required to allocate (and later collect) these arrays ends up being a significant fraction of the total execution time for this benchmark. As a result, this test gives somewhat misleading results.

      It would be better to allocate an array during setup and reuse it by calling Cipher.doFinal(byte[], int, int, byte[]). Also see if this pattern is repeated for other Cipher benchmarks.

        Attachments

          Activity

            People

            • Assignee:
              apetcher Adam Petcher (Inactive)
              Reporter:
              apetcher Adam Petcher (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: