Good afternoon Christian,

On Fri, Sep 17, 2021 at 3:07 PM Christian Schneider
<cschn...@cschneid.com> wrote:
>
> Am 17.09.2021 um 04:09 schrieb tyson andre <tysonandre...@hotmail.com>:
> > I've created a new RFC https://wiki.php.net/rfc/vector proposing to add 
> > `final class Vector` to PHP.
>
>
> First of all: I don't have a strong opinion on a Vector class being useful or 
> necessary.
>
> But I have two comments about this RFC:
> 1) Using the very generic name Vector without any prefix/namespace seems 
> dangerous and asking for BC breaks.
> 2) I don't like that this class is final. The reasons given in 
> https://wiki.php.net/rfc/vector#final_class 
> <https://wiki.php.net/rfc/vector#final_class> seem unconvincing to me and 
> restrict the usage of Vector in a way which makes me question the usefulness 
> to a big enough part of the PHP community.
>
> These two reasons combined would make me reject the RFC at the current stage.

I think it is more in a draft stage for discussions.

To be more precise with my earlier reply, I only see such additions as
useful if it is an actual Vector as known in other languages and
widely used the last years in ML and other similar areas like data or
image processing.

To me a vector is useful if it allows vectorized operations, as in
SIMD, AltVec, CUBA etc. Some refs:

https://users.ece.cmu.edu/~franzf/teaching/slides-18-645-simd.pdf
https://indico.cern.ch/event/238763/attachments/401939/558861/HP-intel_mic_optimization.pdf

These two refer to Intel architecture but ARM (especiall v9 with Neon,
MIPS, ppc and maybe soon riscV does support such operations as well.
It is amazingly well suited for raw performance increase. I can
imagine having annotations and/or specific optimization for vectors of
scalar processing. It requires a bit of (re)thinking, but it is
totally worth it.

Generic multiple data types vectors are less useful for such things
and SplFixedArray does it already, if I understand the RFC, as it
stands now, correctly.

best,
-- 
Pierre

@pierrejoye | http://www.libgd.org

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to