Improve checksum perf by providing an output buffer

This commit is contained in:
Jack Nagel 2013-08-13 15:40:48 -05:00
parent f960cf94d1
commit 22365f2f6d

View File

@ -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