CakePHP 2.0 Rant Retraction

Published on Feb 1, 2011 by Jamie Munro

In yesterday's article, it appears I may have misunderstood something regarding lazy loading.  I incorrectly read it as "loading the data" on-demand oppose to loading the object on-demand.  This actually looks like a great feature, especially after reading this: http://bakery.cakephp.org/articles/Frank/2010/08/10/optimizing-model-loading-with-lazymodel

It appears associated models would automatically be loaded simply because they are related to the model you are querying, even if you are not retrieving data from it.

Thanks for the clarification on lazy loading Jose and I'm actually quite excited to see this change after further research into the situation.  Check out these benchmarks from the above mentioned article:

Before lazy loading


Total Requests made: 100
Total Time elapsed: 6.8480186462402 (seconds)
Requests/Second: 14.603 req/sec
Average request time: 0.068 seconds
Standard deviation of average request time: 0.002
Longest/shortest request: 0.078 sec/0.066 sec
Memory usage: 9.75MB

Post lazy loading


Total Requests made: 100
Total Time elapsed: 4.8957378864288 (seconds)
Requests/Second: 20.426 req/sec
Average request time: 0.049 seconds
Standard deviation of average request time: 0.001
Longest/shortest request: 0.056 sec/0.048 sec
Memory usage: 7.25MB

Almost 6 full requests more per second!  Just in the 100 requests made there is over 2 seconds being gained!  Excellent work community!

Tags: CakePHP | cakephp 2.0 | lazy loading

Related Posts

blog comments powered by Disqus