patch: minimize calls to close() in spawn by calling poll()

Casey Tucker dctucker at github.com
Sat Nov 17 01:57:13 CET 2018


Hello,

Posting this patch to the mailing list per jeroen's instructions.

# Problem Statement
When running GPGME within Docker, the maximum number of FDs may be set
higher than a sane and reasonable values for its specific use-case, causing
many close calls to be issued, introducing a major slowdown in performance
of any calls to the `gpg` binary.

# Proposed Solution
This PR attempts to mitigate the problem by calling `poll` on the entire
range of file descriptors before issuing `close` calls to each file
descriptor. This limits the number of close calls made to the number of
active file descriptors in the current process. It also includes a minor
FIXME.

## Performance before and after

This graph shows the performance of an application signing and then
decrypting a few kilobytes of data.
https://user-images.githubusercontent.com/772810/48650469-0ce7d700-e9ab-11e8-84fd-5e3f6b619220.png

# The patch

https://patch-diff.githubusercontent.com/raw/gpg/gpgme/pull/1.patch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20181116/abb7dd98/attachment.html>


More information about the Gnupg-devel mailing list