• Alex Klyubin's avatar
    Faster evpUpdate for small region of large byte[]. · e9b2cd57
    Alex Klyubin authored
    This improves the speed of computing a digest, a MAC, or a signature
    over a small region of a large byte[] on OpenJDK based VMs.
    Conscrypt's code prior to this CL obtained the reference to the native
    bytes by indexing into the result of JNI GetByteArrayElements. On
    ART/Davlik this avoids creating copies (for 12 kB and larger arrays)
    whereas on OpenJDK based VMs this always creates a copy of all the
    elements of the array, which is not efficient and leads to noticeable
    slowdowns when processing small fractions of the byte array as input.
    
    This commit makes Conscrypt's evpUpdate choose a strategy (
    GetByteArrayElements vs GetByteArrayRegion) based on whether the VM's
    GetByteArrayElements is expected to create a copy of the array. This
    guess is hard-coded for each target: platform, compat, and OpenJDK.
    
    Bug: 27461702
    Change-Id: I4ac1013b29e3d166a3f13fffebf662b02351684f
    e9b2cd57
Android.mk 13.3 KB