private static int readTrailer(byte[] data, int index, int bytes) {
        return SnappyInternalUtils.loadInt(data, index) & wordmask[bytes];
    }
This is a second copy of the inner loop of decompressTags used when near the end
of the input. The key difference is the reading of the trailer bytes.  The fast
code does a blind read of the next 4 bytes as an int, and this code assembles
the int byte-by-byte to assure that the array is not over run.  The reason this
code path is separate is the if condition to choose between these two seemingly
small differences costs like 10-20% of the throughput.  I'm hoping in future
versions of hot-spot this code can be integrated into the main loop but for now
it is worth the extra maintenance pain to get the extra 10-20%.
codec/codec-api/src/main/java/com/alipay/sofa/rpc/codec/snappy/SnappyDecompressor.java