lkml.org 
[lkml]   [2012]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] [PATCH] [timer] Optimise apply_slack() for size and speed.
On 2/2/2012 10:31 PM, Chinmay V S wrote:
> Here is the dis-assembly (build for x86) :
>
> Original code snippet :
> mov %eax,%ecx
> mov $0x1,%edx
> shl %cl,%edx
> sub $0x1,%edx
> mov %edx,-0x10(%ebp)
> not %edx
> and %esi,%edx
> mov %edx,-0x14(%ebp)
>
> Patched code snippet :
> mov %eax,%ecx
> shrl %cl,-0x14(%ebp)
> shll %cl,-0x14(%ebp)
>
> As is evident, we are able to reduce 5 instructions by using a bit-shift
> logic (compared to a masking logic).
>

this code is so not performance critical to this level, that we should
optimize for readability, not for the output of a compiler.




\
 
 \ /
  Last update: 2012-02-03 15:55    [W:0.038 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site