Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 24 Mar 2013 13:32:47 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: question about -falign

* michikaze <michikaze@...ketmail.com> [2013-03-24 14:25:26 +0400]:
> Hello. I'm reading configure script for musl, and those lines
> confused me. Ain't disabling alignment actually hurts performance
> more?

alignment usually adds a constant cost (nop padding)
to reduce the instruction cache pressure of the
following code

so it only helps if the following code fits into the
instruction cache better with the alignment and it is
executed many times or the constant cost is small
otherwise it can make things worse

and if the padding happens to make your code just
large enough so it spans into an extra page, then
you greatly increased the startup cost of your
program

maybe we should have a benchmark suit so it's easy
to answer such questions..

for n>1:

-falign-functions=n has no const cost, but it's not
clear how much you can win in general with it and
libc has a lot of unused interfaces you don't want
to waste space on

-falign-jumps=n has no const cost if the target is
only reachable through jumps

-falign-loops=n can be good or bad depending on how
many times the loop body is executed. there are
many loops in the code and only a few of them are
interesting for performance, aligning the rest just
adds code bloat

-falign-labels=n almost surely hurts performance

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.