 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Ilia Alshanetsky's Blog: PHP's Output Buffering
by Chris Cornutt December 08, 2011 @ 10:01:15
In a new post to his blog Ilia Alshanetsky takes a look at PHP's output buffering feature and some interesting things he found when testing some recent code (hint: it has to do with PHP's "interesting" management of the buffer).
While profiling our application I came across a a rather strange memory usage by the ob_start() function. We do use ob_start() quite a bit to defer output of data, which is a common thing in many applications. What was unusual is that 16 calls to ob_start() up chewing through almost 700kb of memory, given that the data being buffered rarely exceeds 1-2kb, this was quite unusual.
Through a bit more testing he found that, if a buffer provided for content isn't enough, PHP automatically bumps it up by 10kb each time - a waste of resources if you only need a small subset of that. He includes a small patch he made to the PHP core API that allows for defining a custom buffer size and, if it's not enough, bumps up the buffer size by 1kb instead of 10kb.
voice your opinion now!
output buffer increase patch custom size
Terry Chay's Blog: Autoloading and Lazy Loading
by Chris Cornutt April 27, 2009 @ 11:14:26
In this recent post to his blog Terry Chay points out one way he (and Tagged) used to help prevent things like "unknown class" errors in their code - lazy loading.
It's not that Andrei is wrong in his admonition. Far from it! For reasons that I don't quite care to know, there are caching and lookup optimizations that APC cannot do when it has to switch context to run __autoload.
They did see a performance boost from the code rewrite it took to make this happen but, since not everyone can take the time to optimize their code like this, he also suggests another way (as written up by Brian Shire). It uses two settings for APC in your php.ini file and the latest versions of PHP 5.3 & APC along with this patch to make them work.
voice your opinion now!
autoload lazy load apc cache performance increase
Internet Super Hero: PHP mysqli_fetch_all()
by Chris Cornutt August 17, 2007 @ 07:59:00
The Internet Super Hero blog points out a new MySQL function for PHP (included with the new MySQL native drivers) that automatically does what countless sites currently do with a loop - grab all of the results from a database query and stuff them into a single array.
Here is excellent news for you. mysqli_fetch_all(), which comes with mysqlnd, does the task of fetching the data sometimes twice as fast as mysqli_fetch_array(). Reason being: it saves a loop with function calls…
The mysqli_fetch_all function allows you to reduce not only code clutter caused by the loops, but also speeds up the process (by 60% according to his findings). This is based on his current setup, though - under different circumstances (and OSes) there were varying results, but none too much off of the 60% mark. The lowest came in at around a 54% increase.
Check out the entire post on more about this handy function and the full details of the "behind the scenes" of how it works.
voice your opinion now!
mysqlifetchall function speed increase mysqlnd mysqlifetchall function speed increase mysqlnd
Nexen.net: PHP Statistics for July 2006
by Chris Cornutt August 04, 2006 @ 11:39:35
Damien Seguy has submitted information about the latest PHP statistics for this month for July 2006:
Here are the PHP stats for July 2006. To learn about methodology, read la section phpversion. 15 millions servers were surveyed during May, and 8,1 millions were used for stats: domaines without web sites, those unreachable, ISP or domain parkings were not considered.
In brief :
- PHP 5 keep on growing, but slower
- PHP 5.1.4 is now the most popular PHP 5 version
- PHP 4.4.2 is bigger than ever
- New : PHP adoption by governements around the world
For each of the stats, there's a nice graph of various types to show the distribution and information (such as maps for the spread of PHP's market share all across the world).
voice your opinion now!
statistics adoption country ip domain increase statistics adoption country ip domain increase
|
Community Events
Don't see your event here? Let us know!
|