# FastArray, great addition

- Thread: https://externals.io/message/38274
- Original archive: https://news-web.php.net/php.internals/38274
- Started by Pierre Joye on 2008-06-16T10:28:24+00:00
- Messages: 13
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #38274 — Pierre Joye — 2008-06-16T10:28:24+00:00

URL: https://externals.io/message/38274#38274

hi all,

As you noticed already PHP finally got simple C-like array, thanks to
Etienne and Tony for their great work!

My only wish is to actually respect the informal decision we took a
while back, to do not use "fast", "improved", "better" or similar
wording in function or extension names. What's about naming it CArray
or something similar? To reflect what it is, it is not a fast(er) hash
table like our current array, it is a C-like array.


Cheers,
-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #38276 — Alexey Zakhlestin — 2008-06-16T11:27:47+00:00

URL: https://externals.io/message/38274#38276 · In reply to: #38274

> hi all,
>
>  As you noticed already PHP finally got simple C-like array, thanks to
>  Etienne and Tony for their great work!
>
>  My only wish is to actually respect the informal decision we took a
>  while back, to do not use "fast", "improved", "better" or similar
>  wording in function or extension names. What's about naming it CArray
>  or something similar? To reflect what it is, it is not a fast(er) hash
>  table like our current array, it is a C-like array.

and I like that name, because… well it is actually Array (unlike php's
hash/array-mixture) and… well… it is fast ;)

-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

---

## #38277 — Lukas Kahwe Smith — 2008-06-16T11:30:32+00:00

URL: https://externals.io/message/38274#38277 · In reply to: #38276

> 
> > […]
>
> and I like that name, because… well it is actually Array (unlike php's
> hash/array-mixture) and… well… it is fast ;)

so the next tweak will lead to EvenFasterArray?

regards,
Lukas Kahwe Smith
mls@pooteeweet.org

---

## #38278 — Etienne Kneuss — 2008-06-16T11:41:07+00:00

URL: https://externals.io/message/38274#38278 · In reply to: #38274

Hello,

FWIW, I'm fine with SplCArray.

Regards,


> hi all,
>
> As you noticed already PHP finally got simple C-like array, thanks to
> Etienne and Tony for their great work!
>
> My only wish is to actually respect the informal decision we took a
> while back, to do not use "fast", "improved", "better" or similar
> wording in function or extension names. What's about naming it CArray
> or something similar? To reflect what it is, it is not a fast(er) hash
> table like our current array, it is a C-like array.
>
>
> Cheers,
> --
> Pierre
>
> http://blog.thepimp.net | http://www.libgd.org
>



-- 
Etienne Kneuss
http://www.colder.ch

Men never do evil so completely and cheerfully as
when they do it from a religious conviction.
-- Pascal

---

## #38279 — Alexey Zakhlestin — 2008-06-16T11:41:20+00:00

URL: https://externals.io/message/38274#38279 · In reply to: #38277

>  so the next tweak will lead to EvenFasterArray?

I can't imagine anything faster (current FastArray can be optimized to
use SIMD, if needed — that would just be "implementation detail")

well.. the proper name, for current "FastArray" would be just "Array",
but that name is already occupied by hash

I don't like how "CArray" refers to C, because similiar constructs
exist in many languages. maybe "FixedArray"?

-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

---

## #38284 — Gregory Beaver — 2008-06-16T13:36:17+00:00

URL: https://externals.io/message/38274#38284 · In reply to: #38274

Pierre Joye wrote:
> hi all,
> 
> As you noticed already PHP finally got simple C-like array, thanks to
> Etienne and Tony for their great work!
> 
> My only wish is to actually respect the informal decision we took a
> while back, to do not use "fast", "improved", "better" or similar
> wording in function or extension names. What's about naming it CArray
> or something similar? To reflect what it is, it is not a fast(er) hash
> table like our current array, it is a C-like array.

Why not call it SplVector?

Greg

---

## #38285 — Andi Gutmans — 2008-06-16T14:21:47+00:00

URL: https://externals.io/message/38274#38285 · In reply to: #38284

> -----Original Message-----
> From: Gregory Beaver [mailto:greg@chiaraquartet.net]
> Sent: Monday, June 16, 2008 6:36 AM
> To: Pierre Joye
> Cc: PHP internals; Etienne Kneuss; Marcus Boerger; Antony Dovgal
> Subject: [PHP-DEV] Re: FastArray, great addition
> 
> Why not call it SplVector?

I think that's a good suggestion.
I agree we are better off not using Fast in the name.

Andi

---

## #38287 — Pierre Joye — 2008-06-16T14:26:34+00:00

URL: https://externals.io/message/38274#38287 · In reply to: #38285

> > […]
>
> I think that's a good suggestion.
> I agree we are better off not using Fast in the name.

Correct me if I'm wrong but vector are dynamic, the SplFastArray is
not automatically resized. After a short discussion on IRC, the name
SplFixedArray seems to get the general concensus.

Cheers,
-- 
Pierre
http://blog.thepimp.net | http://www.libgd.org

---

## #38345 — Antony Dovgal — 2008-06-18T11:15:58+00:00

URL: https://externals.io/message/38274#38345 · In reply to: #38274

> My only wish is to actually respect the informal decision we took a
> while back, to do not use "fast", "improved", "better" or similar
> wording in function or extension names. What's about naming it CArray
> or something similar? To reflect what it is, it is not a fast(er) hash
> table like our current array, it is a C-like array.

I can live with any name, so feel free to choose whatever you like most.

<offtopic>
Though I'd like to be able to cast these arrays to PHP's arrays 
and we need to implement get_properties() handler for that.
If there are no objections, I'll commit my patch when 
I get back home (30th of June).

-- 
Wbr, 
Antony Dovgal

---

## #38349 — Alexey Zakhlestin — 2008-06-18T12:40:47+00:00

URL: https://externals.io/message/38274#38349 · In reply to: #38345

>  Though I'd like to be able to cast these arrays to PHP's arrays and we need
> to implement get_properties() handler for that.
>  If there are no objections, I'll commit my patch when I get back home (30th
> of June).

2-way conversion would be perfect ;)

-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

---

## #38353 — Antony Dovgal — 2008-06-18T14:47:04+00:00

URL: https://externals.io/message/38274#38353 · In reply to: #38349

> 
> 
> > […]
> 
> 2-way conversion would be perfect ;)

There is no way to cast an array to an object of certain class, 
but it should not be a problem to add a function to convert array to fastarray.

Want to make a patch yourself?
Should be pretty easy to do, just don't forget to throw an exception on string key.

-- 
Wbr, 
Antony Dovgal

---

## #38354 — Alexey Zakhlestin — 2008-06-18T15:17:13+00:00

URL: https://externals.io/message/38274#38354 · In reply to: #38353

> > […]
>
>  There is no way to cast an array to an object of certain class, but it
> should not be a problem to add a function to convert array to fastarray.
>
>  Want to make a patch yourself?
>  Should be pretty easy to do, just don't forget to throw an exception on
> string key.

I will give it a try

-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

---

## #38355 — Etienne Kneuss — 2008-06-18T15:17:41+00:00

URL: https://externals.io/message/38274#38355 · In reply to: #38353

Hello,


> 
> > […]
>
> There is no way to cast an array to an object of certain class, but it
> should not be a problem to add a function to convert array to fastarray.
>
> Want to make a patch yourself?
> Should be pretty easy to do, just don't forget to throw an exception on
> string key.

I'll take care of it (both "conversions" actually)

Regards

>
> --
> Wbr, Antony Dovgal
>
>



-- 
Etienne Kneuss
http://www.colder.ch

Men never do evil so completely and cheerfully as
when they do it from a religious conviction.
-- Pascal
