From: Eric Dumazet
> Sent: 26 May 2015 15:35
> On Tue, 2015-05-26 at 13:40 +0000, David Laight wrote:
> 
> > If the JIT compiler is only changing the encoding of the constants
> > in the x86 instructions (rather than changing the instructions themselves)
> > then there is likely to me an unmeasurable change in the execution time.
> > For instance I don't remember there being a difference in execution time
> > between long and short branches - the only difference is the amount of
> > cache they use.
> 
> icache is precisely the matter here. In the end, it makes a difference.
> 
> You could check this interesting study Ingo did recently :
> 
> https://lkml.org/lkml/2015/5/19/1009

Yes, interesting, a benchmark that manages to run a lot of code 'cold cache'.
Possibly dominated by having a full cache line of code to execute at the
beginning of each function.

My guess is that aligning function bodies helps, aligning branch targets
(as some old versions of gcc used to do aggressively) is more likely to
have a negative effect (increases the icache footprint too much).
Unrolling loops further than needed to avoid data stalls needs very
careful study.

For JIT, once the obviously short branches have been reduced, further code
size reduction might not be worth while.

        David

N�����r��y����b�X��ǧv�^�)޺{.n�+���z�^�)����w*jg��������ݢj/���z�ޖ��2�ޙ����&�)ߡ�a�����G���h��j:+v���w��٥

Reply via email to