rails/actionview
Benjamin Quorning d531edc829 Save a string allocation inside loop
In the `tag_options` method, strings are continuously added to the
`output` string. Previously, we concatenated two strings and added the
generated string to `output`. By adding each of the strings to
`output`, one after the other, we will save the allocation of that
concatenated string.

Benchmark:

    require 'benchmark/ips'

    sep = " ".freeze

    Benchmark.ips do |x|
      x.report("string +") {
        output = ""
        output << sep + "foo"
      }
      x.report("string <<") {
        output = ""
        output << sep
        output << "foo"
      }
      x.compare!
    end

Results (Ruby 2.2.2):

    Calculating -------------------------------------
                string +    88.086k i/100ms
               string <<    94.287k i/100ms
    -------------------------------------------------
                string +      2.407M (± 5.8%) i/s -     12.068M
               string <<      2.591M (± 7.0%) i/s -     12.917M

    Comparison:
               string <<:  2591482.4 i/s
                string +:  2406883.7 i/s - 1.08x slower
2015-08-02 14:31:07 +02:00
..
bin select the AR adapter through bin/test. 2015-06-11 14:24:56 +02:00
lib Save a string allocation inside loop 2015-08-02 14:31:07 +02:00
test Merge pull request #20904 from kaspth/wildcard-template-dependencies 2015-07-27 20:27:57 +02:00
actionview.gemspec Upgrade to Ruby 2.2.2 2015-04-14 08:41:56 +05:30
CHANGELOG.md Add wildcard template dependencies. 2015-07-26 19:21:14 +02:00
MIT-LICENSE Update copyright notices to 2015 [ci skip] 2014-12-31 08:34:14 +01:00
Rakefile Remove unused package tasks 2015-05-28 09:06:10 +02:00
README.rdoc [ci skip] Don’t encourage sudo gem install 2015-05-12 14:51:19 -07:00
RUNNING_UNIT_TESTS.rdoc [ci skip] /sqlite/i --> SQLite 2014-07-06 15:23:12 +05:30

= Action View

Action View is a framework for handling view template lookup and rendering, and provides
view helpers that assist when building HTML forms, Atom feeds and more.
Template formats that Action View handles are ERB (embedded Ruby, typically
used to inline short Ruby snippets inside HTML), and XML Builder.

== Download and installation

The latest version of Action View can be installed with RubyGems:

  % gem install actionview

Source code can be downloaded as part of the Rails project on GitHub

* https://github.com/rails/rails/tree/master/actionview


== License

Action View is released under the MIT license:

* http://www.opensource.org/licenses/MIT


== Support

API documentation is at

* http://api.rubyonrails.org

Bug reports can be filed for the Ruby on Rails project here:

* https://github.com/rails/rails/issues

Feature requests should be discussed on the rails-core mailing list here:

* https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-core