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

Martin Sikora's Blog:
Storing arrays using JSON, serialize and var_export
Aug 09, 2011 @ 14:31:51

Martin Sikora was working on an application that used a large dataset (in an array) and found some interesting things in regards to PHP's resulting loading time and saving time in four different types of arrays.

Recently I was dealing with precessing and storing large arrays in PHP (around 100 000 items) and I found out some quiet surprising facts that are very useful in performance critical applications. [...] When I started looking for some benchmark I found article Cache a large array: JSON, serialize or var_export?. That is really good but I wanted to compare a few more things.

He tested with four different array types including associative with an integer value and numeric index with a string value at sizes of 10, 100, 1,000 and 10,000 items. He ran his tests with the json methods, serializing them and a var_export. There's graphs of his results for each included in the post with some interesting variations between the different array types.

tagged: json serialize varexport large array dataset benchmark

Link:

Brandon Savage's Blog:
Bug-Free: Your Bug-Fixing Toolkit (Part 1 of N)
Oct 16, 2008 @ 15:29:57

Brandon Savage has the first part of a series posted (with N parts) showing off some of the tools that PHP already has built in to make your debugging life easier.

PHP has a large number of tools for fixing bugs and resolving underlying issues. But many people don't know what they are, and some of them are extensions requiring installation in order to work. In this series, we'll explore some features for debugging PHP scripts, from the most basic to more advanced.

He looks at three of the most basic ones (and ones that most developers I know out there use every day) - var_dump, print_r and var_export. Examples of each in use are included...

tagged: debug tool included vardump printr varexport tutorial

Link:

Brian Moon's Blog:
Big arrays in PHP
Feb 27, 2007 @ 13:50:00

In his latest blog entry, Brian Moon takes a look at using big arrays in PHP - how efficient it is and what can be done to ease things a bit.

So, at dealnews, we have a category tree. To make life easy, we dump it to an array in a file that we can include on any page. It has 420 entries. So, I was curious how efficient this was. I noticed that some code that was using this array was jumping in memory usage as soon as I ran the script.

His tests showed that the memory jump from before and after the array was significant (5 MB for his test). He tested different methods of storage for the array including a var_export and serializing the data (the lowest memory option).

tagged: large array optimize performance varexport serialize memory usage large array optimize performance varexport serialize memory usage

Link:

Brian Moon's Blog:
Big arrays in PHP
Feb 27, 2007 @ 13:50:00

In his latest blog entry, Brian Moon takes a look at using big arrays in PHP - how efficient it is and what can be done to ease things a bit.

So, at dealnews, we have a category tree. To make life easy, we dump it to an array in a file that we can include on any page. It has 420 entries. So, I was curious how efficient this was. I noticed that some code that was using this array was jumping in memory usage as soon as I ran the script.

His tests showed that the memory jump from before and after the array was significant (5 MB for his test). He tested different methods of storage for the array including a var_export and serializing the data (the lowest memory option).

tagged: large array optimize performance varexport serialize memory usage large array optimize performance varexport serialize memory usage

Link:


Trending Topics: