While debugging some slow gpgme code in libalpm I noticed that gpgme_get_key() is quite slow (I'm on Windows here, so that might exaggerate the issue).
And I noticed that 40% of the time is spend due to creating a new context, which, given the user serializes the operations, is not strictly needed from what I see.
See the attached patch for a proposal for a faster gpgme_get_key() variant that doesn't do that (missing tests and documentation).
If that's something that would makes sense in gpgme and would be considered, let me know!