PERF: improve perf of array_equivalent_object (GH8512)

xref #8512