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

Rudi Theunissen:
Efficient data structures for PHP 7
Feb 09, 2016 @ 16:49:37

In this recent article over on Medium.com Rudi Theunissen looks at more efficient data structures for PHP 7 and the introduction of a library that wants to help replace some of the current functionality and dependencies on things like arrays.

PHP has one data structure to rule them all. The array is a complex, flexible, master-of-none, hybrid data structure, combining the behaviour of a list and a linked map. But we use it for everything, because PHP is pragmatic.

[...] The recent release of PHP 7 caused a lot of excitement in the PHP community. We couldn't wait to start using the new features and get a taste of the ~2x performance boost. One of the reasons why it runs that much faster is because the array was redesigned. But it’s still the same structure, “optimised for everything; optimised for nothing” with room for improvement.

He starts with a brief mention of some of the current topics around data structures - the SPL functionality, why fixing them would be difficult and, finally, introducing the library that seeks to supersede them. The remainder of the post goes through the pieces of functionality the library offers and explains how each works including videos and graphs of the performance results:

  • Collection
  • Sequence
  • Vector
  • Deque
  • Stack
  • Queue and PriorityQueue
  • Hashable
  • Map
  • Set

He also answers some of the most common questions he's gotten about the library including the level of testing, documentation for the project and why he structured certain elements and features how he did.

tagged: data structure php7 library ds spl optimized video code

Link: https://medium.com/@rtheunissen/efficient-data-structures-for-php-7-9dda7af674cd#.xg74fpxwg

PHPBuilder.com:
6 PHP Performance Tips for Producing Highly Optimized Code
Jul 13, 2011 @ 14:34:17

On PHPBuilder.com today Jason Gilmore offers some performance tips to make highly optimized code without having to use something like HipHop to get closer to the speeds you might need.

While HipHop may seem a rather esoteric solution to the performance problem, a method lies within the perceived madness; maintaining the website logic using PHP code allows Facebook to maintain a code base which remains accessible to a larger number of developers, with the added bonus of being able to deploy blazing fast C++ code. Of course, incorporating HipHop into your infrastructure might not be ideal, but that shouldn't stop you from striving to produce highly optimized PHP code. Read on to learn more about several straightforward steps you can take to boost PHP performance.

Some of the tips included in his list are obvious but could easily be overlooked like:

  • Upgrade your PHP distribution
  • Tone down error reporting
  • Use PHP's native extensions whenever possible
  • Use a PHP accelerator

Take a look at the full post for other suggestions and descriptions of each.

tagged: performance tip optimized code application suggestion

Link:


Trending Topics: