News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Etienne Kneuss' Blog:
SplFastArray to speed up your PHP arrays
June 09, 2008 @ 12:54:04

Etienne Kneuss has posted about a new part of the Standard PHP Library that creates arrays that are up to thirty percent faster than normal methods - SplFastArray.

Antony got the idea to implement a C-like array wrapper in SPL: SplFastArray. The main advantage of that class is performance, it's indeed faster than PHP arrays. How so? No free lunch: The speedup comes from the fact that non-numeric indexes are not allowed and that the array is of fixed size.

The code sample shows the setting of the size for the array (and changing it) with a var_dump of the output result. This method is always faster than normal arrays, it just varies how much from system to system (anywhere from ten to thirty percent).

0 comments voice your opinion now!
spl splfastarray set size speed faster


blog comments powered by Disqus

Similar Posts

NETTUTS.com: 3 Ways to Speed up Your Site with PHP

PHPImpact Blog: 5 great articles on SPL Iterators

Matthew Weir O'Phinney's Blog: Overloading arrays in PHP 5.2.0

International PHP Magazine: IPM Poll Question: How to Speed up Your Site?

HHVM.com: Wow HHVM is fast...too bad it doesn’t run my code


Community Events

Don't see your event here?
Let us know!


opinion release podcast example framework laravel library xdebug community series symfony2 extension version conference introduction api performance interview php7 voicesoftheelephpant

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework