[SCM] The rsync repository. - branch master updated

Rsync CVS commit messages rsync-cvs at lists.samba.org
Mon May 25 03:53:06 UTC 2020


The branch, master has been updated
       via  739fa967 Change odd-ball map_ptr() to use remainder like the others.
       via  d474f298 Improve performance of file_checksum()
      from  a863c62c More NEWS updates.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 739fa967378bfa8956352c9789692a5232a67f66
Author: Wayne Davison <wayne at opencoder.net>
Date:   Sun May 24 20:38:48 2020 -0700

    Change odd-ball map_ptr() to use remainder like the others.

commit d474f2986e656a848780bc8b36a02297e75eb3ab
Author: Jorrit Jongma <git at jongma.org>
Date:   Mon May 25 00:30:55 2020 +0200

    Improve performance of file_checksum()
    
    Previously files were hashed in blocks of CSUM_CHUNK (64) bytes. This
    causes significant overhead. The CSUM_CHUNK define cannot be changed as
    md5.c depends on it, but there is no obvious reason to use it in
    file_checksum(). By using CHUNK_SIZE (32 kB) instead, in some test
    cases throughput more than doubles.

-----------------------------------------------------------------------

Summary of changes:
 checksum.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/checksum.c b/checksum.c
index 2e804c47..fb771402 100644
--- a/checksum.c
+++ b/checksum.c
@@ -294,7 +294,7 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
 	if (fd == -1)
 		return;
 
-	buf = map_file(fd, len, MAX_MAP_SIZE, CSUM_CHUNK);
+	buf = map_file(fd, len, MAX_MAP_SIZE, CHUNK_SIZE);
 
 	switch (checksum_type) {
 	  case CSUM_MD5: {
@@ -302,8 +302,8 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
 
 		MD5_Init(&m5);
 
-		for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK)
-			MD5_Update(&m5, (uchar *)map_ptr(buf, i, CSUM_CHUNK), CSUM_CHUNK);
+		for (i = 0; i + CHUNK_SIZE <= len; i += CHUNK_SIZE)
+			MD5_Update(&m5, (uchar *)map_ptr(buf, i, CHUNK_SIZE), CHUNK_SIZE);
 
 		remainder = (int32)(len - i);
 		if (remainder > 0)
@@ -319,8 +319,8 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
 
 		MD4_Init(&m4);
 
-		for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK)
-			MD4_Update(&m4, (uchar *)map_ptr(buf, i, CSUM_CHUNK), CSUM_CHUNK);
+		for (i = 0; i + CHUNK_SIZE <= len; i += CHUNK_SIZE)
+			MD4_Update(&m4, (uchar *)map_ptr(buf, i, CHUNK_SIZE), CHUNK_SIZE);
 
 		remainder = (int32)(len - i);
 		if (remainder > 0)
@@ -337,8 +337,8 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
 
 		mdfour_begin(&m);
 
-		for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK)
-			mdfour_update(&m, (uchar *)map_ptr(buf, i, CSUM_CHUNK), CSUM_CHUNK);
+		for (i = 0; i + CHUNK_SIZE <= len; i += CHUNK_SIZE)
+			mdfour_update(&m, (uchar *)map_ptr(buf, i, CHUNK_SIZE), CHUNK_SIZE);
 
 		/* Prior to version 27 an incorrect MD4 checksum was computed
 		 * by failing to call mdfour_tail() for block sizes that
@@ -362,9 +362,9 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
 			exit_cleanup(RERR_STREAMIO);
 		}
 
-		for (i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
+		for (i = 0; i + CHUNK_SIZE <= len; i += CHUNK_SIZE) {
 			XXH_errorcode const updateResult =
-			    XXH64_update(state, (uchar *)map_ptr(buf, i, CSUM_CHUNK), CSUM_CHUNK);
+			    XXH64_update(state, (uchar *)map_ptr(buf, i, CHUNK_SIZE), CHUNK_SIZE);
 			if (updateResult == XXH_ERROR) {
 				rprintf(FERROR, "error computing XXH64 hash");
 				exit_cleanup(RERR_STREAMIO);
@@ -373,7 +373,7 @@ void file_checksum(const char *fname, const STRUCT_STAT *st_p, char *sum)
 
 		remainder = (int32)(len - i);
 		if (remainder > 0)
-			XXH64_update(state, (uchar *)map_ptr(buf, i, CSUM_CHUNK), remainder);
+			XXH64_update(state, (uchar *)map_ptr(buf, i, remainder), remainder);
 		SIVAL64(sum, 0, XXH64_digest(state));
 
 		XXH64_freeState(state);


-- 
The rsync repository.



More information about the rsync-cvs mailing list