diff options
| author | Jack Nagel | 2013-08-13 15:40:48 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-08-13 15:40:48 -0500 |
| commit | f2689d502de7b8b15e7167283c41e87e5aec963c (patch) | |
| tree | e59aa71c9cc6738878bbfa5906c83c8ee73a4e00 /Library | |
| parent | 0fd31a54a63416133b806c07df20e861b797b2f2 (diff) | |
| download | homebrew-f2689d502de7b8b15e7167283c41e87e5aec963c.tar.bz2 | |
Improve checksum perf by providing an output buffer
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 7 |
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 |
