Compute snappy encoding outside the lock