[jifty-devel] A slow pony and suboptimal loops

Jesse Vincent jesse at bestpractical.com
Sun Dec 17 21:51:58 EST 2006




On Mon, Dec 18, 2006 at 10:18:56AM +0800, Agent Zhang wrote:
> On 12/18/06, Jesse Vincent <jesse at bestpractical.com> wrote:
> >> To be more specific, the following loop takes too much time:
> >>
> >>        my @value = grep { $_->{value} eq $value }
> >>                        @{ $self->action->available_values($self->name) };
> >>        $value = $value[0]->{display} if scalar @value;
> >
> >
> >Is it that available_values isn't being cached? If so, would precaching
> >it help?
> >
> 
> Jesse, are you sure you really want to cache it? I've checked the size
> of the array returned by available_values:
> 
>    WARN - Count: 529
> 
> It's exactly as huge as my sessions table! Moreover, the whole
> rander_values sub doesn't do anything useful at all in my situation
> because there's no column named "name" in my sessions table.

Now I'm very, very confused. This is only for a select box, right?
What's going on that it's polling your sessions table?


> I believe Jifty should do something smarter here. available_values
> shouldn't return everything in a database table IMHO. Database tables
> can be extremely large.

How are you setting up the available values for that column?


> Currently loading my message's admin page takes me 21 sec (not
> counting the loading time of css and js) on my Pentium IV machine
> ((3.0 GHz, 512 MB RAM)). Right, it's terrible. Benchmark shows that it
> only takes 7 sec if skipping the useless loop completely.
> 
> Yes, 7 sec is still too long. But it's much much more acceptable than
> 21 sec. You know, demonstrating the Jifty pony in front of my
> instructor really really drove me mad. ;-)
> 
> Cheers,
> Agent
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
> 

-- 


More information about the jifty-devel mailing list