array compare performance improvement