On 2014-01-20 14:51, Richard W.M. Jones wrote:
On Mon, Jan 20, 2014 at 02:45:59PM +0000, Gordan Bobic wrote:
On 2014-01-01 21:09, Richard W.M. Jones wrote:
On Wed, Jan 01, 2014 at 12:21:30PM -0800, Sean Omalley wrote:
They are a problem. It is a performance issue at the very least on =ALL= platforms. There is a cost even on Intel's platform for alignment errors, they just fix them up in hardware so it isn't as big of a performance hit. It might be 5 cycles instead of 20.
On Intel Sandybridge and up there is no penalty:
http://www.agner.org/optimize/blog/read.php?i=142&v=t
On earlier Intel processors it's not significant:
http://lemire.me/blog/archives/2012/05/31/data-alignment-for-speed-myth-or-r...
Anyway, you are optimizing far too early. If there's a performance problem, run 'perf', find out that it's caused by X where X might be the big misalignment penalty on ARM or many other things, then fix that.
I have just run the test on my Samsung Chromebook (A15) and the results are concerning:
processing word of size 8 offset = 0 ignore this: average time for offset 0 is 77.95 offset = 1 ignore this: average time for offset 1 is 3465.2 offset = 2 ignore this: average time for offset 2 is 3454.25 offset = 3 ignore this: average time for offset 3 is 3451.2
That is 44x slower.
Is this a synthetic benchmark, or is some actual running code from Fedora 44x slower?
This is based on the test on the page you posted a link to above.
I never said that fixups were free, obviously going in and out of the kernel to emulate an instruction is going to take some time.
You seemed to imply it above by saying that penalty on recent x86 is non-existant on Sandy Bridge and insignificant on slightly less recent x86 CPUs.
The question is whether it noticably affects any code.
It certainly seems to affect the nss build process quite badly, specifically the test stage (which actually fails some tests on ARM, concerningly). Whether it affects the runtime I don't know, I don't think I use it - the only crypto related packages I use are OpenSSH and mod_ssl, both of which, AFAIK, link against OpenSSL rather than nss.
Gordan