aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-08-13 15:40:48 -0500
committerJack Nagel2013-08-13 15:40:48 -0500
commit22365f2f6d268113ed48a168389e7339df68c956 (patch)
tree1e8ee34ecb0fca97eee99226ee986b42d7644aac /Library
parentf960cf94d1762862e61eb7095f37759b070b5f94 (diff)
downloadbrew-22365f2f6d268113ed48a168389e7339df68c956.tar.bz2
Improve checksum perf by providing an output buffer
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/pathname.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index fc2df4407..fedb30ef8 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -211,11 +211,8 @@ class Pathname
def incremental_hash(hasher)
incr_hash = hasher.new
- self.open('r') do |f|
- while(buf = f.read(1024))
- incr_hash << buf
- end
- end
+ buf = ""
+ open('r') { |f| incr_hash << buf while f.read(1024, buf) }
incr_hash.hexdigest
end