Diffusion GnuPG 2b5718c1f768

common/iobuf: optimize iobuf_read_line

Authored by jukivili on Nov 8 2018, 8:31 PM.

Description

common/iobuf: optimize iobuf_read_line

* common/iobuf.c (iobuf_read_line): Add fast path for finding '\n'
character in buffer.

This patch reduce per byte overhead in iobuf_read_line by avoiding
using iobuf_get when possible and use memchr to find '\n'. This
speeds armored decryption.

Benchmark results below, tested on Intel Core i7-4790K (turbo off).
Encrypted 2 GiB through pipe to ramfs file using AES128. Decrypt
ramfs file out through pipe to /dev/null.

before patch-set

gpg process

armor: user time pipe transfer rate
encrypt-aead: 13.8 140 MB/s
decrypt-aead: 30.6 68 MB/s
encrypt-cfb: 17.4 114 MB/s
decrypt-cfb: 32.6 64 MB/s

after (decrypt+iobuf opt)

gpg process

armor: user time pipe transfer rate
decrypt-aead: 22.5 92 MB/s
decrypt-cfb: 24.4 85 MB/s

  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Committed
jukiviliNov 8 2018, 8:31 PM
Parents
rG47424881b27d: g10/armor: remove unused unarmor_pump code
Branches
Unknown
Tags
Unknown