<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hello,</div><div><br></div><div>Posting this patch to the mailing list per jeroen's instructions.<br></div><div dir="ltr"><br></div><div dir="ltr"># Problem Statement<br>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.<br><br># Proposed Solution<br>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.<br><br>## Performance before and after<br><br>This graph shows the performance of an application signing and then decrypting a few kilobytes of data. <a href="https://user-images.githubusercontent.com/772810/48650469-0ce7d700-e9ab-11e8-84fd-5e3f6b619220.png">https://user-images.githubusercontent.com/772810/48650469-0ce7d700-e9ab-11e8-84fd-5e3f6b619220.png</a></div><div dir="ltr"><br></div><div># The patch<br></div><div dir="ltr"><br></div><div dir="ltr"><a href="https://patch-diff.githubusercontent.com/raw/gpg/gpgme/pull/1.patch">https://patch-diff.githubusercontent.com/raw/gpg/gpgme/pull/1.patch</a><br></div></div></div></div>