oop too slow
| From: | Krzysztof Gorzelak | Date: | Thu, 19 Aug 2004 08:49:49 +0000 |
| Subject: | oop too slow | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-194230@lists.php.net to get a copy of this message | ||
Hi
I'm trying my new php5 script, but it takes about 1.2s to generate my page.
That is, how my oop model looks like :
[category]
| | |
[photo] [desc] [products]
[products]
|
[product]
| | |
[photo] [desc] [keys]
[keys]
|
[key]
|
[values]
|
[value]
Each object gets data from mysql by itself. The generation time of 1
category [30 products, 10 keys, 5 values ~= 300 mysql queries] takes as I
said more than a 1s (on quite fast machine). How can this model be improved?
Do I create too many objects ? What are the oop solutions for such problem ?
I also use an extra table to create many-to-many relation betwean a product
and a key. Is this the only way in mysql ?
[product]
|
[product_id, key_id]
|
[key]
Thanks a lot help
Krzysztof Gorzelak
krzysztof@uno.pl