1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

g10/sign: sign_file: 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 <jussi.kivilinna@iki.fi>
This commit is contained in:
Jussi Kivilinna 2022-02-10 20:07:34 +02:00
parent 4e27b9defc
commit f8943ce098

View File

@ -1328,7 +1328,7 @@ 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;
@ -1339,7 +1339,7 @@ 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)
;
}
}