Friday, March 6, 2009

Zend_Date vs DateTime performance

After running into some issues with slowness on a project I am working on using the Zend Framework I started trying to hunt down the issue. In this case, the problem was being caused by using Zend_Date. Here are the results of my tests:

Results using PHP's DateTime


ab -n 100 -c 10 http://localhost/test/datebm_php.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient).....done


Server Software: Apache/1.3.37
Server Hostname: localhost
Server Port: 80

Document Path: /test/datebm_php.php
Document Length: 22 bytes

Concurrency Level: 10
Time taken for tests: 0.163 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 26100 bytes
HTML transferred: 2200 bytes
Requests per second: 613.44 [#/sec] (mean)
Time per request: 16.301 [ms] (mean)
Time per request: 1.630 [ms] (mean, across all concurrent requests)
Transfer rate: 156.36 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.4 1 3
Processing: 5 15 5.2 13 37
Waiting: 4 15 5.2 13 37
Total: 5 16 5.3 14 38

Percentage of the requests served within a certain time (ms)
50% 14
66% 15
75% 18
80% 21
90% 25
95% 27
98% 30
99% 38
100% 38 (longest request)


Results using Zend_Date

ab -n 100 -c 10 http://localhost/test/datebm_zend.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient).....done


Server Software: Apache/1.3.37
Server Hostname: localhost
Server Port: 80

Document Path: /test/datebm_zend.php
Document Length: 22 bytes

Concurrency Level: 10
Time taken for tests: 6.724 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 26100 bytes
HTML transferred: 2200 bytes
Requests per second: 14.87 [#/sec] (mean)
Time per request: 672.386 [ms] (mean)
Time per request: 67.239 [ms] (mean, across all concurrent requests)
Transfer rate: 3.79 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.3 1 2
Processing: 87 648 157.0 663 1502
Waiting: 87 647 154.6 663 1502
Total: 88 649 156.9 664 1503

Percentage of the requests served within a certain time (ms)
50% 664
66% 677
75% 697
80% 708
90% 757
95% 785
98% 1187
99% 1503
100% 1503 (longest request)


And here is the code

datebm_php.php
<?php 

date_default_timezone_set('America/New_York');

$dbDate = date("Y-m-d H:i:s");

$date = new DateTime($dbDate);
echo $date->format('m/d/Y h:iA');
?>


datebm_zend.php
<?php 

date_default_timezone_set('America/New_York');

$dbDate = date("Y-m-d H:i:s");

function __autoload ($class)
{
$file = str_replace("_", "/", $class) . ".php";
include_once($file);
}
Zend_Date::setOptions(array('format_type' => 'php'));
$date = new Zend_Date($dbDate, Zend_Date::ISO_8601);
echo $date->get('m/d/Y h:iA');
?>

Tuesday, September 2, 2008

Chrome - Google's Web Browser

Multi-process enabled, free, and more competition to the web broswer world.

It can be download from:

An fun and informative method of delivery to learn more about Chrome:
http://www.google.com/googlebooks/chrome/index.html

Sunday, April 27, 2008

How to install AVG Free Anti-Virus without LinkScanner

Installing AVG 8.0 Free Edition without the LinkScanner component can be accomplished using the following parameter with the install executable:

/REMOVE_FEATURE fea_AVG_SafeSurf /REMOVE_FEATURE fea_AVG_SafeSearch

Example of a complete command line:
c:\avg_free_stf_*.exe /REMOVE_FEATURE fea_AVG_SafeSurf /REMOVE_FEATURE fea_AVG_SafeSearch
(Of course, the location of the installer may be different than the above example.)

This can be run even after AVG 8.0 Free Edition has been installed. However, the virus definitions may need to be updated again after completing this.

Source:
http://free.grisoft.com/ww.faq.num-1241

Sunday, April 13, 2008

Microsoft PowerToys for Windows XP

A helpful set of free utilities called Microsoft PowerToys <http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx>. Today, the "Image Resizer" from this collection elimanted the need to install a full blown image editor to perform quick resizing of images before attaching them to an e-mail.

Tuesday, March 18, 2008

Safari 3.1 update adds Web Inspector

The Safari 3.1 update adds a nice new feature called Web Inspector. The web inspector has some features developers may have seen before in the firefox extensions firebug and yslow.

To enable the develop menu go to Safari->Preferences->Advanced and check the box that says "Show Develop menu in menu bar"

Then from the Safari menu you can chose Develop->Show Web Inspector.

Thursday, March 13, 2008

Apple TV and Philips LCD TV sound issues

I purchased the 160GB Apple TV a few weeks ago. From day one I had issues with the sound with my configuration. I have the Apple TV connected to a Philips 42" LCD TV with HDMI cable. I then have the coaxial digital audio out from my TV to a Pioneer receiver. With the setup I can always get sound from my TV speakers, but not all sounds are output to my stereo.

The audio path is:
AppleTV -> Philips LCD TV (HDMI) -> Pioneer Receiver (Digital Coax)

Here are some observations:

  • The startup audio on Apple TV plays fine through stereo, this sound is about 15-20 seconds long, after that the only sound that can be heard from the stereo is the sound of the button chirps using the remote.
  • If I toggle between HDMI inputs on the TV ending on the one Apple TV is hooked to, the sound will play through the stereo for 4-5 seconds then cuts out, but I can still hear it through the tv. After it cuts out I can only hear the remote chirp sounds
  • After playing around with it a bit, I ended up finding one audio clip that will play normally
Some searching lead me to this thread where people had similar issues: http://discussions.apple.com/thread.jspa?messageID=6601200

A call to Apple support eventually led me to a product specialist who said they don't support a setup where the sound passes through a middle device.

I ended up hooking the audio output directly from the Apple TV into my stereo, which sounds fine but a little inconvenient in that I have to use 2 remotes to switch from Directv to Apple TV, maybe its time for a Harmony One.

Anyway, the issue seems to be something to do with the Apple TV 2.0 upgrade and how the Philips LCD TV processes audio. If you have had similar issues, please comment.

Wednesday, March 12, 2008

WinDirStat

WinDirStat <http://windirstat.info/> is handy tool. It is very similar to TreeSize. Both tools provide reports of disk usage on a given volume. However, WinDirStat has a better graphical interface, appears to be complete its reporting task in less time, and has entertaining animations when performing its work (you'll have to try it to see - think Pac-Man).

Below is a screen shot of a completed scan of a volume. You can click on the various graphical chunks which will update the other two window panes accordingly. It is fun, free and useful to track storage usage of volume.




I discovered WinDirStat while reading the following NetApp blog about Vista's large installation base, <http://blogs.netapp.com/incorrigible_techno/2007/12/28-gb.html>.

March 13, 2008 additions:

  1. Thanks to Jim (see comments) for pointing out the Mac OS X equivlant - Disk Inventory X http://www.derlien.com/
  2. There is KDirStat for "Linux, BSD, and lots of other Unix-type systems (Solaris, HP-UX, AIX, ...)" http://kdirstat.sourceforge.net/
  3. KDirStat was the original, WinDirStat is a "clone", and then came Disk Inventory X (sources are from the previous two links).