Messages in this thread | | | Date | Fri, 03 Feb 2012 06:52:23 -0800 | From | Arjan van de Ven <> | Subject | Re: [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.
| |