Hi,

$zfDate1->compareDate($zfDate2) === 0  VS 
$zfDate1->get('yyyyMMdd') === $zfDate2->get('yyyyMMdd')

Loop using if($zfDate1->compareDate($zfDate2) === 0)

2010-08-16T19:06:56+02:00 DEBUG (7): PHP 2 : 0.89702701568604 seconds
2010-08-16T19:06:59+02:00 DEBUG (7): PHP 2 : 1.3131721019745 seconds
2010-08-16T19:07:01+02:00 DEBUG (7): PHP 2 : 0.82378101348877 seconds
2010-08-16T19:07:04+02:00 DEBUG (7): PHP 2 : 1.1371161937714 seconds
2010-08-16T19:07:06+02:00 DEBUG (7): PHP 2 : 0.84517693519592 seconds
2010-08-16T19:07:09+02:00 DEBUG (7): PHP 2 : 0.84347915649414 seconds
2010-08-16T19:07:11+02:00 DEBUG (7): PHP 2 : 0.90793299674988 seconds
2010-08-16T19:07:19+02:00 DEBUG (7): PHP 2 : 1.4202959537506 seconds
2010-08-16T19:07:22+02:00 DEBUG (7): PHP 2 : 1.1105830669403 seconds

Loop using if($zfDate1->get('yyyyMMdd') === $zfDate2->get('yyyyMMdd'))

2010-08-16T19:06:24+02:00 DEBUG (7): PHP 1 : 0.22183299064636 seconds
2010-08-16T19:06:28+02:00 DEBUG (7): PHP 1 : 0.2126841545105 seconds
2010-08-16T19:06:30+02:00 DEBUG (7): PHP 1 : 0.39605712890625 seconds
2010-08-16T19:06:32+02:00 DEBUG (7): PHP 1 : 0.2227840423584 seconds
2010-08-16T19:06:34+02:00 DEBUG (7): PHP 1 : 0.21170997619629 seconds
2010-08-16T19:06:36+02:00 DEBUG (7): PHP 1 : 0.38899707794189 seconds
2010-08-16T19:06:40+02:00 DEBUG (7): PHP 1 : 0.21395707130432 seconds
2010-08-16T19:06:42+02:00 DEBUG (7): PHP 1 : 0.39756608009338 seconds
2010-08-16T19:06:44+02:00 DEBUG (7): PHP 1 : 0.21865105628967 seconds

The difference is huge, using comparators like ===, < or > on the date's
string is about 4 to 5 times faster than using e.g. compareDate.

So why not compare the string's in compareDate method ?
-- 
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Date-Performance-issues-using-compare-functions-tp2327205p2327205.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to