Re: Performance tests of some AES implementations in C

From: Christophe Devine (devine_at_iie.cnam.fr)
Date: 07/03/03


Date: Wed, 2 Jul 2003 23:06:09 +0000 (UTC)

Mok-Kong Shen <mok-kong.shen@t-online.de> wrote:

> Christophe Devine wrote:

> > As I needed to compare my AES code against others, I've quickly
> > coded a benchmark of a few open-source implementations of Rijndael:
> > mine, Brian Gladman's, Mok-Kong Shen's, the NIST Reference Code and
> > Tom St Denis' AES implementation.

> With some exceptions your code performs better than all others in
> enc/dec. Do you have an explanation of that fact? Thanks.

Well, I've tried to make the code as simple and straightforward as
possible; I also used a few basic tricks, like loop unrolling.
It also seems that my code was heavily optimized for gcc 2.95,
as the benchmarks results are much different when switching to a
more recent version of gcc:

  * Debian's gcc 2.95.4 without optimization flags

         ks (keys/s) enc. (bytes/s) dec. (bytes/s)
devine 371781.08 18171184.34 17964105.88
gladman 686440.75 19691701.69 19002601.79
mks 146858.73 18685040.37 19166496.48
nist 37290.18 349575.11 235588.39
tom 570060.42 16945114.28 18371060.50

  * Debian's gcc 2.95.4 with -O

         ks (keys/s) enc. (bytes/s) dec. (bytes/s)
devine 496747.54 31151434.67 30278657.39
gladman 811487.40 26714306.79 25412558.10
mks 208611.05 27080776.59 27105551.25
nist 75439.90 384127.06 257610.50
tom 1148996.11 24918044.22 29516754.45

  * gcc 3.3 without optimization flags

         ks (keys/s) enc. (bytes/s) dec. (bytes/s)
devine 447602.53 22149007.99 21558548.32
gladman 703920.48 22065922.98 21129782.90
mks 170851.10 20100502.79 19621669.83
nist 41707.69 295926.72 172438.71
tom 623074.29 17086076.19 19242102.24

  * gcc 3.3 with -O3 and -march=pentium3

         ks (keys/s) enc. (bytes/s) dec. (bytes/s)
devine 1129892.42 25321262.92 27273966.29
gladman 947274.67 21427327.81 20585927.88
mks 211747.10 29014679.62 29017573.00
nist 89265.19 821398.43 592663.70
tom 1275428.86 27841339.17 19752110.71

In fact all implementations (except nist) yield roughly the
same results; yours performs very well actually :-).

-- 
Christophe Devine


Relevant Pages