Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an optimization for trivial batch sizes. #151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Oct 2, 2020

  1. Add an optimization for trivial batch sizes.

    When told to validate zero signatures, there's no need to go through
    any pre-computation to be sure that there are no invalid signatures
    in the empty set.
    
    When told to validate one signature, a single signature verification
    call is faster than validating a single signature via the
    batch-verification mechanism.
    
    On my not-very-reliable desktop, the performance difference is ~99%
    when there are no signatures, and ~25% when there is one signature.
    
    Why would a programmer use batch verification in this case?
    Sometimes it makes sense to write code that handles an unknown
    number of signatures at once: for example, when validating a
    download that contains multiple objects, between zero and many of
    which are ed25519-signed objects.  Instead of the programmer having
    to pick which API to use, IMO it's better just to make the "batch"
    API fast in all cases.
    
    This commit adds cases for 0 and 1-signature batches to the
    benchmark.  It also adds a case for a 2-signature batch, to verify
    that batch verification is faster for all n>1.
    nmathewson committed Oct 2, 2020
    Configuration menu
    Copy the full SHA
    c3badb7 View commit details
    Browse the repository at this point in the history