Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #5650 (new defect)

Opened 2 years ago

Last modified 2 years ago

ActionView::Helpers::TagHelper.tag_options sort is slow

Reported by: mark@waverodeo.com Assigned to: David
Priority: normal Milestone: 1.2.7
Component: ActionPack Version: 1.1.1
Severity: normal Keywords:
Cc: bitsweat

Description

Sure to be controversial (otherwise I'd patch and submit, sorry). Profiling reveals that the call to sort in tag_options is terribly slow on a page laden with quite a few tags (say, a list of stock transactions with links on each one to edit or delete the transaction). But yes, sigh, it beautifies the generated HTML.

def tag_options(options)

cleaned_options = convert_booleans(options.stringify_keys.reject {|key, value| value.nil?}) ' ' + cleaned_options.map {|key, value| %(#{key}="#{html_escape(value.to_s)}")}.sort * ' ' unless cleaned_options.empty?

end

Change History

07/08/06 23:52:15 changed by bitsweat

  • cc set to bitsweat.
  • version set to 1.1.1.
  • milestone set to 1.2.

Should be unnecessary since we have assert_dom_equal now. Do patch + update the tests.