[jifty-devel] A slow pony and suboptimal loops
Jesse Vincent
jesse at bestpractical.com
Sun Dec 17 11:52:39 EST 2006
> Jifty's pony is terribly slow when loading the model admin page for
> nontrivial apps. I've chasing the bottle-neck tonight and have found
> it is located at:
>
> admin/fragments/list/list
> admin/fragments/list/view
> <% $update->form_field($argument, render_mode => 'read') %>
> Jifty::Action::form_field
> Jifty::Web::Form::Field::""
> Jifty::Web::Form::Select::render_value
>
> The render_value method takes a lot of time when processing columns
> referring to external tables. I've seen Jesse checked in this
> implementation in rev 1059:
>
> http://svn.jifty.org/index.cgi/jifty/revision?rev=1059
>
> 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?
> I can see two potential ways to optimize this:
>
> 1. Optimize the loop itself by using List::Util::first or something like
> that.
> 2. Skip the loop completely if there's no "name" column in the target table.
>
> Any ideas?
>
> 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