We optimize for this fast-path so much, that it's probably worth computing is_constant with a short-circuiting statistics accumulator, i.e. bail as soon as we know it to be false.
We can then change ArrayData::is_constant and ArrayData::as_constant to always compute.
We may well want to lazily proxy ArrayView stats through a mutable object, although worth checking the cache hits on this one since ArrayView children are always constructed every time they are accessed.
We optimize for this fast-path so much, that it's probably worth computing is_constant with a short-circuiting statistics accumulator, i.e. bail as soon as we know it to be false.
We can then change
ArrayData::is_constant
andArrayData::as_constant
to always compute.We may well want to lazily proxy ArrayView stats through a mutable object, although worth checking the cache hits on this one since ArrayView children are always constructed every time they are accessed.