Bug 1455143 - Use a reasonable buffer size for reading files; r?Build draft
authorGregory Szorc <gps@mozilla.com>
Wed, 18 Apr 2018 15:38:04 -0700
changeset 785302 9d6153d219fa39b3c9590dd9c86819d717adb6a1
parent 785301 02fe36000269a0a100bd7a5ca6fb6f32f3700dce
child 785303 2f6c2a920ffde243b84b57b6ec8eed8be12362e4
push id107184
push userbmo:gps@mozilla.com
push dateThu, 19 Apr 2018 21:22:59 +0000
reviewersBuild
bugs1455143
milestone61.0a1
Bug 1455143 - Use a reasonable buffer size for reading files; r?Build Reading in 1kb chunks in 2018 is insane. MozReview-Commit-ID: 7wJv6fTAOh7
build/checksums.py
--- a/build/checksums.py
+++ b/build/checksums.py
@@ -7,17 +7,17 @@ from __future__ import with_statement
 
 from optparse import OptionParser
 import hashlib
 import logging
 import os
 
 logger = logging.getLogger('checksums.py')
 
-def digest_file(filename, digest, chunk_size=1024):
+def digest_file(filename, digest, chunk_size=131072):
     '''Produce a checksum for the file specified by 'filename'.  'filename'
     is a string path to a file that is opened and read in this function.  The
     checksum algorithm is specified by 'digest' and is a valid OpenSSL
     algorithm.  If the digest used is not valid or Python's hashlib doesn't
     work, the None object will be returned instead.  The size of blocks
     that this function will read from the file object it opens based on
     'filename' can be specified by 'chunk_size', which defaults to 1K'''
     assert not os.path.isdir(filename), 'this function only works with files'