Switch branches/tags
Find file History
y-yagi Enable `Performance/UnfreezeString` cop
In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`.

```ruby
# frozen_string_literal: true

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  gem "benchmark-ips"
end

Benchmark.ips do |x|
  x.report('+@') { +"" }
  x.report('dup') { "".dup }
  x.compare!
end
```

```
$ ruby -v benchmark.rb
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
Warming up --------------------------------------
                  +@   282.289k i/100ms
                 dup   187.638k i/100ms
Calculating -------------------------------------
                  +@      6.775M (± 3.6%) i/s -     33.875M in   5.006253s
                 dup      3.320M (± 2.2%) i/s -     16.700M in   5.032125s

Comparison:
                  +@:  6775299.3 i/s
                 dup:  3320400.7 i/s - 2.04x  slower

```
Latest commit 1b86d90 May 17, 2018
Permalink
..
Failed to load latest commit information.
cache Switch to supports_cache_versioning? check to a class method Sep 21, 2018
concurrency Prevent deadlocks with load interlock and DB lock. Nov 9, 2017
core_ext Merge pull request #33800 from aeroastro/feature/doc-change-for-blank Sep 13, 2018
dependencies [Active Support] require_relative => require Oct 21, 2017
deprecation Remove unused require Jul 31, 2018
duration Enable `Performance/UnfreezeString` cop Sep 22, 2018
inflector Remove unused `require "active_support/core_ext/regexp"` Jul 29, 2018
json Don't dup Strings when jsonifying Apr 26, 2018
locale Improve the performance of `ActiveSupport::Inflector.ordinal` Apr 29, 2018
log_subscriber [Active Support] require_relative => require Oct 21, 2017
messages Fix RotationConfiguration test and remove nil-kind rotates. Sep 24, 2017
multibyte Remove unused `require "active_support/core_ext/regexp"` Jul 29, 2018
notifications Only use CLOCK_PROCESS_CPUTIME_ID if it's defined Jul 29, 2018
number_helper Deprecate "active_support/core_ext/numeric/inquiry" Mar 3, 2018
testing Oxford comma [ci skip] Sep 10, 2018
values Turn on performance based cops Jul 23, 2018
xml_mini Enable `Performance/UnfreezeString` cop Sep 22, 2018
all.rb [Active Support] require_relative => require Oct 21, 2017
array_inquirer.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
backtrace_cleaner.rb Use backtrace cleaner to clean up backtrace for verbose query logs Aug 13, 2018
benchmarkable.rb [Active Support] require_relative => require Oct 21, 2017
builder.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
cache.rb Support skip nil for cache fetch (#25437) Aug 5, 2018
callbacks.rb Improve documentation of Procs as :if / :unless options for callbacks Aug 20, 2018
concern.rb removed unnecessary returns Oct 28, 2017
configurable.rb Remove unused `require "active_support/core_ext/regexp"` Jul 29, 2018
core_ext.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
current_attributes.rb [ci skip] Prefer cookies.encrypted over signed (#30129) Aug 8, 2017
dependencies.rb trace autoloads, and document hints for troubleshooting Sep 7, 2018
deprecation.rb Update default deprecation horizon Jan 31, 2018
descendants_tracker.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
digest.rb Don't include ellipsis in truncated digest output Dec 17, 2017
duration.rb Merge pull request #31923 from jdelStrother/duration-deserialization Feb 7, 2018
encrypted_configuration.rb Remove unused `serialize` method Mar 25, 2018
encrypted_file.rb Change temporary file name extension while editing encrypted file. Mar 18, 2018
evented_file_update_checker.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
execution_wrapper.rb [Active Support] require_relative => require Oct 21, 2017
executor.rb [Active Support] require_relative => require Oct 21, 2017
file_update_checker.rb [Active Support] require_relative => require Oct 21, 2017
gem_version.rb Start Rails 6.0 development!!! Jan 30, 2018
gzip.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
hash_with_indifferent_access.rb Remove extra conditions in HWIDA since Rails 6 does not support Ruby 2.2 Feb 17, 2018
i18n.rb `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordi… Mar 5, 2018
i18n_railtie.rb Fix typo in i18n_railtie.rb Sep 6, 2018
inflections.rb [Active Support] require_relative => require Oct 21, 2017
inflector.rb [Active Support] require_relative => require Oct 21, 2017
json.rb [Active Support] require_relative => require Oct 21, 2017
key_generator.rb Fix typo 'in via' Jul 6, 2018
lazy_load_hooks.rb A Class is a Module so we remove one conditional Jul 4, 2018
log_subscriber.rb [Active Support] require_relative => require Oct 21, 2017
logger.rb [Active Support] require_relative => require Oct 21, 2017
logger_silence.rb [Active Support] require_relative => require Oct 21, 2017
logger_thread_safe_level.rb [Active Support] require_relative => require Oct 21, 2017
message_encryptor.rb Turn on performance based cops Jul 23, 2018
message_verifier.rb Update incorrect backtick usage in RDoc to teletype Nov 22, 2017
multibyte.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
notifications.rb [Active Support] require_relative => require Oct 21, 2017
number_helper.rb Add missing documentation options to number_to_currency [ci skip] Jul 11, 2018
option_merger.rb [Active Support] require_relative => require Oct 21, 2017
ordered_hash.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
ordered_options.rb [Active Support] require_relative => require Oct 21, 2017
per_thread_registry.rb [Active Support] require_relative => require Oct 21, 2017
proxy_object.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
rails.rb Rails 6 requires Ruby 2.4.1+ Feb 17, 2018
railtie.rb Use SHA-1 for non-sensitive digests by default Jan 8, 2018
reloader.rb Merge pull request #30100 from kirs/doc-reloader Nov 17, 2017
rescuable.rb [Active Support] require_relative => require Oct 21, 2017
security_utils.rb Compare the actual string after comparing the HMAC proccessed strings Nov 25, 2017
string_inquirer.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
subscriber.rb Fix Rubocop offense Jul 26, 2018
tagged_logging.rb Merge pull request #27792 from tjoyal/sandbox-tagged-logging Sep 11, 2018
test_case.rb use "minitest" consistently Sep 11, 2018
time.rb [Active Support] require_relative => require Oct 21, 2017
time_with_zone.rb Update the comments for TimeWithZone subtraction (#33721) Aug 28, 2018
version.rb [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` Jul 11, 2017
xml_mini.rb Call `YAML.load` correctly Feb 21, 2018