Making a gpg library

tftp tftp at
Mon Oct 23 17:21:55 CEST 2000

--- Michael Still <mikal at> wrote:

> I would like to sign and then verify nightly nine million documents. That
> wont work with an API that execs the gpg command line. I also imagine that
> execing a command line utility is not nearly as robust or secure as
> calling the API. There are all those temporary files that have to be
> cleaned up etc.

I ran few tests:

$ time ./gpgrun 1
0.01user 0.01system 0:00.26elapsed 7%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (611major+152minor)pagefaults 0swaps

$ time ./gpgrun 10
0.07user 0.03system 0:00.89elapsed 11%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (3815major+972minor)pagefaults 0swaps

$ time ./gpgrun 100
0.58user 0.20system 0:09.52elapsed 8%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (35855major+9162minor)pagefaults 0swaps

$ time ./gpgrun 1000
5.70user 1.89system 1:32.86elapsed 8%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (356255major+91062minor)pagefaults 0swaps

for ($n=0; $n < $ARGV[0]; ++$n) {
        system("gpg --version > /dev/null");

The perl overhead will be somewhat visible on low pass counts but
should be irrelevant on longer tests.

Runs       Time, s.    Time increase   Pass cost, s.
1          0:00.26          1            0.26
10         0:00.89          3            0.09
100        0:09.52         36            0.09
1000       1:32.86        358            0.09

As we see, numerous invocations of gpg (as a new process)
cost 90 ms. per invocation on AMD Athlon 450 MHz, Linux 2.2.17.
The first pass has a lot more cost because Perl and gpg aren't
cached yet. This test does not involve actual crypto work; if
that is included then cost of loading gpg becomes even smaller.


Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.

More information about the Gnupg-devel mailing list