From 22365f2f6d268113ed48a168389e7339df68c956 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 13 Aug 2013 15:40:48 -0500 Subject: Improve checksum perf by providing an output buffer --- Library/Homebrew/extend/pathname.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'Library') 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 -- cgit v1.2.3