openssl performance delta built-in vs custom compiled

Marcus Pollice marcus.pollice at gmail.com
Fri Dec 12 22:53:56 UTC 2014


Merely by accident I noticed that the performance of the 
package-installed openssl on recent Ubuntu releases is higher for small 
data sizes than a version I build myself from source.

Since the speed difference is biggest at small data sizes and gradually 
shrinks until it vanishes almost completely at 8K, I wonder what kind of 
optimization causes it.

A similar discrepancy could be observed on other machines, using both 
AMD and Intel CPUs. I'd like to understand how to reproduce the 
performance figures obtained by the packaged version of openssl.

I already tried different compiler versions (gcc 4.7 and 4.8 for now) 
and setting the same compiler flags (the Ubuntu version uses slightly 
different settings from the defaults) but none of these things changed 
the performance of the version I compiled myself.

Here is a comparison of SHA1 performance of openssl 1.0.1. The first 
line is the custom compiled version using the default compiler options 
and gcc-4.8. The second line is the packaged version from Ubuntu 14.04. 
The tests were conducted using the "openssl speed sha1" commandline. 
While these are single-run results, they show the difference quite 
obviously. Over a number of runs the numbers would fluctuate a bit, but 
the big picture would stay the same.

16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
43820.90k   132959.30k   363443.97k   607209.05k   751168.04k
72599.17k   205490.32k   461793.19k   665659.93k   758138.09k

Machine specs:
AMD FX-8350 (4GHz, 8 core, boost enabled)
8GB DDR3-1600

I observed similar performance behavior on different machines across a 
variety of AMD and Intel processors and also across a range of different 
(older) Ubuntu releases. A similar delta could also be experienced on 
the MD5 algorithm. I merely focussed on SHA1 because of work-related 
interest.

I'd be grateful if someone could point out the reason for the difference 
and also how to compile binaries to achieve the same performance.

Best regards,

-- 
Marcus Pollice





More information about the Ubuntu-devel-discuss mailing list