On Martes, 3 de Mayo de 2011 07:50:25 Michael Latta escribió:
> I found at least some of it.  There are 5 associations formatted as
> selects.  There are a large number (5) of select associations per record
> and with 50 records each record spends about 20 ms generating options,
> sorting the collections and so on.  There has to be a way to cache those
> options to save a lot of time.

You can override options_for_association to cache options for each 
association:
def options_for_association(association, include_all = false)
  options_cache = include_all ? @options_cache_all||={} : @options_cache||={}
  options_cache[association.name] ||= super
end

It will work only if options must be the same for all records in all subforms.

> 
> Michael
> 
> On May 2, 2011, at 11:31 PM, Michael Latta wrote:
> > I have a form that is performing very badly.  The form has a large number
> > of sub-form records being displayed: 50 or so.
> > 
> > The log shows 200-300 ms for the horizontal header, and about 100 ms for
> > each record.  The attribute partials account for about 42 ms of the 100
> > per record.
> > 
> > When I attempt to measure the code executed by the header template it is
> > more like 1-2 ms for the calls like getting the config or testing
> > columns for hidden.
> > 
> > The total query time reported is < 20 ms and the view time reported is <
> > 10 ms
> > 
> > The records have a large number of  association columns with form_ui
> > :select.
> > 
> > This is on the VHO fork as a gem under 1.9.2p180.
> > 
> > Michael

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to