Optimize `&array_merge_recursive_distinct` method