aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_dependency.rb
diff options
context:
space:
mode:
authorJack Nagel2013-05-06 16:08:50 -0500
committerJack Nagel2013-05-06 16:08:50 -0500
commitb32202033881d93849f4c44a837389e8a9d450ef (patch)
tree70c0aada3617c66ddce596ccd20ba3df79fc887e /Library/Homebrew/test/test_dependency.rb
parent894a6c9776e33a1ece665e2f8118cd17012878fd (diff)
downloadbrew-b32202033881d93849f4c44a837389e8a9d450ef.tar.bz2
Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting and then defensively flattening and compacting things, we can avoid allocating a bunch of unnecessary arrays. This gives a performance boost of roughly 4% when enumerating 2500 formulae, and has the side effect of cleaning up the dependency API.
Diffstat (limited to 'Library/Homebrew/test/test_dependency.rb')
-rw-r--r--Library/Homebrew/test/test_dependency.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/Library/Homebrew/test/test_dependency.rb b/Library/Homebrew/test/test_dependency.rb
index 2eac358e6..0f030afd6 100644
--- a/Library/Homebrew/test/test_dependency.rb
+++ b/Library/Homebrew/test/test_dependency.rb
@@ -20,7 +20,7 @@ end
class DependencyTests < Test::Unit::TestCase
def test_accepts_single_tag
- dep = Dependency.new("foo", "bar")
+ dep = Dependency.new("foo", %w{bar})
assert_equal %w{bar}, dep.tags
end
@@ -30,7 +30,7 @@ class DependencyTests < Test::Unit::TestCase
end
def test_preserves_symbol_tags
- dep = Dependency.new("foo", :build)
+ dep = Dependency.new("foo", [:build])
assert_equal [:build], dep.tags
end