1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test
yuuji.yaginuma 1b86d90136 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

```
2018-09-23 08:56:55 +09:00
..
application Make sure this test check the issue solved in #31135 2018-09-22 00:46:44 -04:00
command Use did_you_mean spell checker for option suggestions 2018-03-23 11:36:03 +02:00
commands Support environment specific credentials file. (#33521) 2018-09-19 14:02:00 -07:00
configuration
engine Use correct variable 2018-09-11 07:06:30 +09:00
fixtures/lib
generators Enable Performance/UnfreezeString cop 2018-09-23 08:56:55 +09:00
isolation Enable Performance/UnfreezeString cop 2018-09-23 08:56:55 +09:00
minitest rubocop single space after assignment 2018-02-19 11:23:47 +05:30
railties Enable Layout/EmptyLinesAroundBlockBody to reduce review cost in the future 2018-07-12 21:29:48 +09:00
test_unit Show rails instead of bin/rails on USAGE instructions 2018-07-06 22:46:54 +02:00
abstract_unit.rb
app_loader_test.rb Turn on performance based cops 2018-07-23 15:37:06 -07:00
backtrace_cleaner_test.rb Use backtrace cleaner to clean up backtrace for verbose query logs 2018-08-14 09:15:28 +10:00
code_statistics_calculator_test.rb use "minitest" consistently 2018-09-11 23:57:25 +02:00
code_statistics_test.rb
console_helpers.rb Enable Performance/UnfreezeString cop 2018-09-23 08:56:55 +09:00
credentials_test.rb Support environment specific credentials file. (#33521) 2018-09-19 14:02:00 -07:00
engine_test.rb Use assert_predicate and assert_not_predicate 2018-01-25 23:32:59 -05:00
env_helpers.rb
generators_test.rb Remove unnecessary test 2018-06-03 20:53:05 +09:00
initializable_test.rb
json_params_parsing_test.rb
path_generation_test.rb
paths_test.rb Use assert_predicate and assert_not_predicate 2018-01-25 23:32:59 -05:00
rack_logger_test.rb Fix test added in #32444 2018-04-06 14:00:13 +03:00
rails_info_controller_test.rb
rails_info_test.rb Replace assert ! with assert_not 2018-04-19 08:11:33 -04:00
secrets_test.rb Deprecate encrypted secrets in favor of credentials. 2017-11-12 17:50:09 +01:00
version_test.rb