aboutsummaryrefslogtreecommitdiffstats
path: root/sm/gpgsm.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-05-08 07:16:35 +0000
committerWerner Koch <[email protected]>2023-05-08 07:40:14 +0000
commit08ff55bd44aea6cd8b25384ee7d127576866ec71 (patch)
treeb7c8bd096f8b4aa2590040ef5564abc556666166 /sm/gpgsm.c
parentkbx: Use wrapper functions for es_fclose and es_fopen. (diff)
downloadgnupg-08ff55bd44aea6cd8b25384ee7d127576866ec71.tar.gz
gnupg-08ff55bd44aea6cd8b25384ee7d127576866ec71.zip
kbx: Use custom estream buffering
* kbx/keybox-init.c (ll_buffer_size): New var intialized to 128k (stream_buffers): New var. (keybox_set_buffersize): New. (_keybox_ll_open, _keybox_ll_close): Implement buffering. * sm/gpgsm.c (oKbxBufferSize): New. (opts): Add option --kbx-buffer-size. (main): Call keybox_set_buffersize. * g10/gpg.c: Include keybox.h. * (oKbxBufferSize): New. (opts): Add option --kbx-buffer-size. (main): Call keybox_set_buffersize. -- Running a test on Windows using a pubring.kbx with Total number of blobs: 2098 openpgp: 1294 x509: 803 and a size of 42MiB with gpgsm -k --with-validation --disable-dirmngr --kbx-buffer-size N >nul gives these performance figures using procmon | N(k) | file events | time(s) | |------+-------------+---------| | 0 | 4900000 | 86 | | 16 | 2456000 | 58 | | 32 | 1233000 | 43 | | 64 | 622000 | 37 | | 128 | 317000 | 32 | | 256 | 164000 | 31 | | 512 | 88000 | 30 | Using _open instead of CreateFile give the same number of file events but increased the time slight by one second for the measured buffer size of 64k and 128k. Benchmarks for gpg have not been conducted.
Diffstat (limited to 'sm/gpgsm.c')
-rw-r--r--sm/gpgsm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index aeb6ad7a9..55173f8a2 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -213,6 +213,7 @@ enum cmd_and_opt_values {
oKeyboxdProgram,
oRequireCompliance,
oCompatibilityFlags,
+ oKbxBufferSize,
oNoAutostart
};
@@ -447,6 +448,7 @@ static gpgrt_opt_t opts[] = {
ARGPARSE_s_s (oXauthority, "xauthority", "@"),
ARGPARSE_s_s (oChUid, "chuid", "@"),
ARGPARSE_s_s (oCompatibilityFlags, "compatibility-flags", "@"),
+ ARGPARSE_p_u (oKbxBufferSize, "kbx-buffer-size", "@"),
ARGPARSE_header (NULL, ""), /* Stop the header group. */
@@ -1492,6 +1494,10 @@ main ( int argc, char **argv)
case oRequireCompliance: opt.require_compliance = 1; break;
+ case oKbxBufferSize:
+ keybox_set_buffersize (pargs.r.ret_ulong, 0);
+ break;
+
default:
if (configname)
pargs.err = ARGPARSE_PRINT_WARNING;