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

Vectorized support for array equals/compare/mismatch using Unsafe

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • None
    • core-libs
    • b103

      JDK-8033148 will add methods to Arrays for array equals, compare and mismatch.

      The implementations of equals, compare and mismatch can be reimplemented using underlying mismatch methods that in turn defer to a single method, vectorizedMismatch, that accesses the memory contents of arrays using Unsafe.getLongUnaligned.

      The vectorizedMismatch implemetnation can be optimized efficiently by C2 to obtain an approximate 8x speed up when performing a mismatch on byte[] arrays (of a suitable size to overcome fixed costs).

      The contract of vectorizedMismatch is simple enough that it can be made an intrinsic (see JDK-8044082) and leverage SIMDs instructions to perform operations up to a width of say 512 bits on supported architectures. Thus even further performance improvements may be possible.

            psandoz Paul Sandoz
            psandoz Paul Sandoz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: