Zend_Date tooooooooo slow, real slow?

Problem is your cache lifetime is really low. Zend_Date uses Zend_Locale, that parses some XMLs (not very small ones), which takes lots and lots of time. Create special cache instance with extremely long lifetime (or better tie it to a files' modified time) and set that to both Zend_Date and Zend_Locale.

That should speedup things dramatically. But it's not a good idea to use Zend_Date for say... echoing date in orders list. You can use date('d.m.

Y', strtotime($timeFromDb)) You should use Zend_Date when doing date calculations or other advanced things with dates. Not for simple choing, unless you need abbility to echo it practically in any locale :).

In really I need to use Zend_Validate_Date, and when I tried to use it, I stayed more than 60 second waiting for the script. Then debbuging i've found that the slow problem begans with Zend_Date and Zend_Locale – nacho3d Jun 2 at 14:00 That's what the part about caching Locale and Date with long lifetime adresses ;) – TomáÅ¡ Fejfar Jun 3 at 22:57.

Zend_Date and a few other Zend classes are known to be slow. You can speed-up subsequent calls to Zend_Date by using your cache: $date = new Zend_Date(...); .... $cachedDate = new Cache($date); print $cachedDate->toString(); I know this will sound simplistic but if you just need a formatted regular date, just use php's built-in date object. I guarantee you will see a major speed difference.

UPDATE: If you really want to tweak the class to improve performance, this post has a couple of patches / tweaks you can apply.

The script slows down when I try to create the Zend_Date object. --- so caching of toString() wouldn't help in this case (supposing what OP says is true) – zerkms Jun 2 at 2:52 It wouldn't help on instanciation, and it says so in the post. If he is not re-using the object, php's native class would be better.

If he IS re-using the object, the cache is an interesting alternative. – stefgosselin Jun 2 at 3:21.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions