aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2022-11-29 10:58:11 +0000
committerWerner Koch <[email protected]>2022-11-29 10:58:11 +0000
commit2302e180c010dffe0b792063955938cd3599e8fe (patch)
tree8bfdacdea08aaa19143e1798a960cf549a6b15e2
parentg10/plaintext: do_hash: use iobuf_read for higher performance (diff)
downloadgnupg-2302e180c010dffe0b792063955938cd3599e8fe.tar.gz
gnupg-2302e180c010dffe0b792063955938cd3599e8fe.zip
gpg: use iobuf_read for higher detached signing speed
* g10/sign.c (sign_file): Use iobuf_read instead of iobuf_get for reading data from detached file. -- This patch reduces iobuf_read per byte processing overhead and speeds up detached signing. Detached signing speed on AMD Ryzen 5800X (4.3GiB file, SHA256): gpg process user time before: 3.951s after: 1.898s (2.0x faster) GnuPG-bug-id: T5826 Signed-off-by: Jussi Kivilinna <[email protected]> Backported-from-master: f8943ce098f6f193da791faf43fff823568697d9 Numbers above are given for the version in master but should be similar for here (2.2).
-rw-r--r--g10/sign.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/g10/sign.c b/g10/sign.c
index f27231950..17c6bcdf8 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -1211,8 +1211,8 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
iobuf_push_filter( inp, text_filter, &tfx );
}
iobuf_push_filter( inp, md_filter, &mfx );
- while( iobuf_get(inp) != -1 )
- ;
+ while (iobuf_read (inp, NULL, 1<<30) != -1 )
+ ;
iobuf_close(inp); inp = NULL;
}
if( opt.verbose )
@@ -1220,8 +1220,8 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
}
else {
/* read, so that the filter can calculate the digest */
- while( iobuf_get(inp) != -1 )
- ;
+ while (iobuf_read (inp, NULL, 1<<30) != -1 )
+ ;
}
}
else {