Improve checksum perf by providing an output buffer
This commit is contained in:
parent
f960cf94d1
commit
22365f2f6d
@ -211,11 +211,8 @@ class Pathname
|
|||||||
|
|
||||||
def incremental_hash(hasher)
|
def incremental_hash(hasher)
|
||||||
incr_hash = hasher.new
|
incr_hash = hasher.new
|
||||||
self.open('r') do |f|
|
buf = ""
|
||||||
while(buf = f.read(1024))
|
open('r') { |f| incr_hash << buf while f.read(1024, buf) }
|
||||||
incr_hash << buf
|
|
||||||
end
|
|
||||||
end
|
|
||||||
incr_hash.hexdigest
|
incr_hash.hexdigest
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user