From the blog
Posted 2010-08-17
During the past week, I've been looking at different strategies for
autoloading in Zend Framework.
I've suspected for some time that our class loading strategy might be one source
of performance degradation, and wanted to research some different approaches,
and compare performance.
In this post, I'll outline the approaches I've tried, the benchmarking stategy I
applied, and the results of benchmarking each approach.
From the blog
Posted 2008-01-01
2007 was a busy year, both personally and professionally. I won't go into the
personal too much, because, well, it's personal, and some of the details
are simply inappropriate for blogging material.
Here's the short version:
- One trip to Belgium and The Netherlands.
- Two trips to Israel.
- Two trips to Atlanta, GA (not counting the return trip from Europe, when I was stranded for a day due to storms in the Northeast).
- Three different user groups attended, with three presentations.
- One major Zend Framework release
- One PEAR release.
- One podcast.
- One webinar.
- One book published.
- One conference attended.
What follows is my month-by-month breakdown:
From the blog
Posted 2007-07-05
Over the past few evenings, I've refactored
File_Fortune to
have it implement Iterator, Countable, and ArrayAccess — basically allowing it
to act like an array for most intents and purposes. As a result, I've eliminated
the need for the File_Fortune_Writer package, and greatly simplified the
usage.
(Note: sure, File_Fortune may not be that big of a deal, but over 1000
downloads in the past two years indicates somebody is using it. Plus, it
powers the random quotes on the family website. :-) )
As some examples:
require_once 'File/Fortune.php';
$fortunes = new File_Fortune('/path/to/fortunedir');
echo $fortunes->getRandom();
$fortunes->setFile('myfortunes');
foreach ($fortunes as $fortune) {
echo str_repeat('-', 72), "\n", $fortune, "\n\n";
}
$fortunes[7] = "I never really liked that fortune anyways.";
$fortunes->save();
$fortunes->add('This is a shiny new fortune!');
$index = count($fortunes) - 1;
echo $fortunes[$index];
All-in-all, it's a much better interface. Lesson learned: when porting code from
other languages, it pays to take some time and determine if there might be a
better API in your own.
In upcoming releases, I hope to modify the backend to use PHP's Streams API
instead of direct file access, and also to allow providing a list of fortune
files explicitly. After that, I should be ready for the initial stable release.
Update (2007-07-10): fixed parse error in examples