Optimize simple array comparison (Issue 9477)