aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorschneems <richard.schneeman+foo@gmail.com>2018-09-07 13:45:01 -0500
committerschneems <richard.schneeman+foo@gmail.com>2018-09-07 17:33:10 -0500
commit1bd578ffe6e89cbe828745c15d730be2ce850109 (patch)
tree7d4c93e3f4c4e4af7d80478ef49ff428d2ee6356 /actionview/test
parentc3e569550ca0a90561fe990f519719ba52402504 (diff)
downloadrails-1bd578ffe6e89cbe828745c15d730be2ce850109.tar.gz
rails-1bd578ffe6e89cbe828745c15d730be2ce850109.tar.bz2
rails-1bd578ffe6e89cbe828745c15d730be2ce850109.zip
Don’t allocate array on no args
When no dependencies are present to be digested there is no reason to build an array just to turn around and turn it back into a string. The dependencies array is not mutated in this method so we can use the same empty array across all invocations. Total allocated: 791402 bytes (7294 objects) Total allocated: 777442 bytes (7132 objects) (791402 - 777442) / 791402.0 # => 1.76 % speed improvement
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/activerecord/relation_cache_test.rb2
-rw-r--r--actionview/test/template/render_test.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/actionview/test/activerecord/relation_cache_test.rb b/actionview/test/activerecord/relation_cache_test.rb
index bd0cd10eaf..56e17e67a8 100644
--- a/actionview/test/activerecord/relation_cache_test.rb
+++ b/actionview/test/activerecord/relation_cache_test.rb
@@ -19,5 +19,5 @@ class RelationCacheTest < ActionView::TestCase
assert_equal "Hello World", controller.cache_store.read("views/path/projects-#{Project.count}")
end
- def view_cache_dependencies; end
+ def view_cache_dependencies; []; end
end
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb
index 8782eb4430..6ff7ddba0f 100644
--- a/actionview/test/template/render_test.rb
+++ b/actionview/test/template/render_test.rb
@@ -10,7 +10,7 @@ module RenderTestCases
def setup_view(paths)
@assigns = { secret: "in the sauce" }
@view = Class.new(ActionView::Base) do
- def view_cache_dependencies; end
+ def view_cache_dependencies; []; end
def combined_fragment_cache_key(key)
[ :views, key ]