En-/Decryption speed for large files (GnuPG and Gpg4win)

Ángel angel at pgp.16bits.net
Mon Jan 16 02:01:39 CET 2023


On 2023-01-15 at 23:14 +0800, Ming Kuang via Gnupg-users wrote:
> On Sunday, January 15, 2023 5:52 PM, Christoph Klassen wrote:
> > When I was testing the decryption I also tried "gpg --decrypt
> > test_file.gpg" (without output file) with the 10 GB file and it took 8
> > minutes and 47 seconds. I was wondering why it took longer when GnuPG
> > didn't need to create an output file.
> 
> As far as I know, outputting text to the screen (like printf) is a very time 
> consuming operation, it will block you until all printing is complete.
> 
> gpg --decrypt test_file.gpg without output file will print all the decrypted 
> contents on the screen, which may be the reason why it takes so long.

Generally speaking, I wouldn't consider printing to the screen "very
expensive" (i.e. print if you need to), but if you need to output a lot
of text, the other side (the terminal) will need to process and draw it
into the screen (think on it as a pipe), which will be slow with lots
of text or extremely long lines. Moreover, in Windows it will be
processed to convert LF into CRLF, and then moved into the Terminal
subsystem.

For any test like this where you are not going to process the output
(e.g. to compare it) I would recommend writing into the null device 
(/dev/null in *nix, nul in Windows).

Also, when measuring encryption make sure it is not trying to use
compression (based on the preferences of your test key). The time spent
by the compressor on your uncompressible files would be just an
unneeded source of variation.

Regards





More information about the Gnupg-users mailing list