DEV: Use Set instead of array-as-an-object (PR #14511)

I don’t know if JS engines were able to optimize-away those gigantic arrays but in any case that’s a definite anti-pattern.

GitHub