Re: oop too slow
| From: | Aidan Lister | Date: | Thu, 19 Aug 2004 10:04:35 +0000 |
| Subject: | Re: oop too slow | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194234@lists.php.net to get a copy of this message | ||
Krzysztof,
Take a look at some PHP Profiling extensions, such as Advanced PHP Debugger
or XDebug. This will help you locate the slow parts of your script.
"Krzysztof Gorzelak" <krzysztof@uno.pl> wrote in message
news:20040819084951.88650.qmail@pb1.pair.com...
> 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