Re: [symfony-users] Slow template rendering

2010-01-28 Thread Georg Gell
Axel,

is it possible that the creation of the user objects takes such a long
time? I don't know what your user objects do, or how many are in this
list, but just for displaying the names of the users, I wouldn't
create objects, but hydrate with Doctrine_Core::HYDRATE_SCALAR.
Try if this works more quickly:

set up this method in your Event object:

class Event extends BaseEvent{
...
public function getUserListAsArray()
{
  return Doctrine::getTable('Users')->createQuery()->where('event_id =
?', $this->id)->execute(array(), Doctrine_Core::HYDRATE_SCALAR);
}

and in the template:

getUserListAsArray() as $user){
echo <<
  {$user['firstname']} {$user['lastname']}

EOT;
} ?>

Does this solve your speed problem?

Georg

Am 27.01.2010 19:58, schrieb axel at:
> hello list,
> 
> symfony seems to be extrem slow - compared to "native" php
> a request with the following code takes ~26 seconds (count($event-
>> getUserList()) == 5000)
> 
> getUserList() as $user):  ?>
>
>   getFirstname(). " ". $user->getLastname
> (); ?>
> 
>  
> 
> type  calls   time (ms)   time (%)
> Configuration 13  1932.20 7
> Factories 1   361.77  1
> Database (Doctrine)   8   0.060
> Action "event/listAction" 1   19.53   0
> View "Success" for "event/listAction" 1   25653.2093
> Partial "event/_assets"   1   1.410
> Partial "event/_flashes"  1   5.310
> Component "address/menuItems" 1   68.60   0
> Partial "address/_menuItems"  1   3.230
> Component "address/loginState"1   0.060
> Partial "address/_loginState" 1   2.060
> 
> the doctrine database query is ok
> I don't think that the templating is the problem, (I tried to do the
> output with echo $user->... from within the action what took as long
> as if I used the template engine. for me it seems to be a doctrine
> problem (foreach...?)
> 
> is there a way to improove this poor results?
> 

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.



Re: [symfony-users] Slow template rendering

2010-01-28 Thread Gareth McCumskey
Well there will always be -some- overhead of using a framework. I
think that he's been using the dev environment for these benchmarks
which does add a lot of extra processing that you don't normally get
in the production environment. The benchmark of production environment
vs "simple" PHP will not be that different. Of course it will still
favour the "simple" PHP, but then we aren't using symfony to make an
application run faster, we use it to enforce certain design patterns
(MVC) to our projects to make them easier to extend and maintain. If
performance is the number 1 priority (and all the symfony performance
improvements that are available have not worked) then any framework
will not be a good choice. If you are however developing an
application where extensibility and maintainability is your priority
then frameworks like symfony are the best choice. Its all about
getting your priorities straight.

One last thing @OP, are you using a memory caching application like
APC Cache? If not, this can dramatically speed up a symfony
application.

On Thu, Jan 28, 2010 at 12:27 PM, Stéphane  wrote:
> Well it looks like he tried using simple php and it worked great.
>
> Does the db query for user listing clearly "SELECT * FROM users" or such a
> thing stating it selects all fields ?
>
>
> Before Printing, Think about Your Environmental Responsibility!
> Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!
>
>
> On Thu, Jan 28, 2010 at 11:25 AM, Gareth McCumskey 
> wrote:
>>
>> Did you run it through the dev environment? If so, the dev environment
>> adds an additional processing overhead to the application as it keeps
>> track of a number of different variables and symfony states to allow
>> for debugging purposes. Also, try running the query itself on your
>> databases command line client to help determine if perhaps the
>> database itself is just really slow.
>>
>> On Wed, Jan 27, 2010 at 8:58 PM, axel at  wrote:
>> > hello list,
>> >
>> > symfony seems to be extrem slow - compared to "native" php
>> > a request with the following code takes ~26 seconds (count($event-
>> >>getUserList()) == 5000)
>> >
>> > getUserList() as $user):  ?>
>> >       
>> >          getFirstname(). " ". $user->getLastname
>> > (); ?>
>> >        
>> >  
>> >
>> > type    calls   time (ms)       time (%)
>> > Configuration   13      1932.20 7
>> > Factories       1       361.77  1
>> > Database (Doctrine)     8       0.06    0
>> > Action "event/listAction"       1       19.53   0
>> > View "Success" for "event/listAction"   1       25653.20        93
>> > Partial "event/_assets" 1       1.41    0
>> > Partial "event/_flashes"        1       5.31    0
>> > Component "address/menuItems"   1       68.60   0
>> > Partial "address/_menuItems"    1       3.23    0
>> > Component "address/loginState"  1       0.06    0
>> > Partial "address/_loginState"   1       2.06    0
>> >
>> > the doctrine database query is ok
>> > I don't think that the templating is the problem, (I tried to do the
>> > output with echo $user->... from within the action what took as long
>> > as if I used the template engine. for me it seems to be a doctrine
>> > problem (foreach...?)
>> >
>> > is there a way to improove this poor results?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "symfony users" group.
>> > To post to this group, send email to symfony-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > symfony-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/symfony-users?hl=en.
>> >
>> >
>>
>>
>>
>> --
>> Gareth McCumskey
>> http://garethmccumskey.blogspot.com
>> twitter: @garethmcc
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "symfony users" group.
>> To post to this group, send email to symfony-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> symfony-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "symfony users" group.
> To post to this group, send email to symfony-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.



Re: [symfony-users] Slow template rendering

2010-01-28 Thread Stéphane
Well it looks like he tried using simple php and it worked great.

Does the db query for user listing clearly "SELECT * FROM users" or such a
thing stating it selects all fields ?


Before Printing, Think about Your Environmental Responsibility!
Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!


On Thu, Jan 28, 2010 at 11:25 AM, Gareth McCumskey wrote:

> Did you run it through the dev environment? If so, the dev environment
> adds an additional processing overhead to the application as it keeps
> track of a number of different variables and symfony states to allow
> for debugging purposes. Also, try running the query itself on your
> databases command line client to help determine if perhaps the
> database itself is just really slow.
>
> On Wed, Jan 27, 2010 at 8:58 PM, axel at  wrote:
> > hello list,
> >
> > symfony seems to be extrem slow - compared to "native" php
> > a request with the following code takes ~26 seconds (count($event-
> >>getUserList()) == 5000)
> >
> > getUserList() as $user):  ?>
> >   
> >  getFirstname(). " ". $user->getLastname
> > (); ?>
> >
> >  
> >
> > typecalls   time (ms)   time (%)
> > Configuration   13  1932.20 7
> > Factories   1   361.77  1
> > Database (Doctrine) 8   0.060
> > Action "event/listAction"   1   19.53   0
> > View "Success" for "event/listAction"   1   25653.2093
> > Partial "event/_assets" 1   1.410
> > Partial "event/_flashes"1   5.310
> > Component "address/menuItems"   1   68.60   0
> > Partial "address/_menuItems"1   3.230
> > Component "address/loginState"  1   0.060
> > Partial "address/_loginState"   1   2.060
> >
> > the doctrine database query is ok
> > I don't think that the templating is the problem, (I tried to do the
> > output with echo $user->... from within the action what took as long
> > as if I used the template engine. for me it seems to be a doctrine
> > problem (foreach...?)
> >
> > is there a way to improove this poor results?
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "symfony users" group.
> > To post to this group, send email to symfony-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> .
> > For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
> >
> >
>
>
>
> --
> Gareth McCumskey
> http://garethmccumskey.blogspot.com
> twitter: @garethmcc
>
> --
> You received this message because you are subscribed to the Google Groups
> "symfony users" group.
> To post to this group, send email to symfony-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.



Re: [symfony-users] Slow template rendering

2010-01-28 Thread Gareth McCumskey
Did you run it through the dev environment? If so, the dev environment
adds an additional processing overhead to the application as it keeps
track of a number of different variables and symfony states to allow
for debugging purposes. Also, try running the query itself on your
databases command line client to help determine if perhaps the
database itself is just really slow.

On Wed, Jan 27, 2010 at 8:58 PM, axel at  wrote:
> hello list,
>
> symfony seems to be extrem slow - compared to "native" php
> a request with the following code takes ~26 seconds (count($event-
>>getUserList()) == 5000)
>
> getUserList() as $user):  ?>
>       
>          getFirstname(). " ". $user->getLastname
> (); ?>
>        
>  
>
> type    calls   time (ms)       time (%)
> Configuration   13      1932.20 7
> Factories       1       361.77  1
> Database (Doctrine)     8       0.06    0
> Action "event/listAction"       1       19.53   0
> View "Success" for "event/listAction"   1       25653.20        93
> Partial "event/_assets" 1       1.41    0
> Partial "event/_flashes"        1       5.31    0
> Component "address/menuItems"   1       68.60   0
> Partial "address/_menuItems"    1       3.23    0
> Component "address/loginState"  1       0.06    0
> Partial "address/_loginState"   1       2.06    0
>
> the doctrine database query is ok
> I don't think that the templating is the problem, (I tried to do the
> output with echo $user->... from within the action what took as long
> as if I used the template engine. for me it seems to be a doctrine
> problem (foreach...?)
>
> is there a way to improove this poor results?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "symfony users" group.
> To post to this group, send email to symfony-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> symfony-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/symfony-users?hl=en.
>
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.