On 03/26/2013 10:51 PM Matt Turner wrote:
On Tue, Mar 26, 2013 at 2:44 PM, Bengt Richter<[email protected]>  wrote:
uint32_t
component_delta2(uint32_t next, uint32_t prev)
{
     return ((((next&0xff00ff)-(prev&0xff00ff)+0x100)&0xff00ff)+
         (((next&0xff00)-(prev&0xff00))&0xff00));
}

Does removing all the spaces make it faster? ;)
LOL .. actually I didn't put them in in the first place ;-)
But inlining might make the calling loop faster.

Hm, easy to try now ... inlining cut the time in almost in half again.
I assigned to a volatile so the loop wouldn't get optimized away.
I just have a loop in the test kludge like

    else if (strcmp(argv[1],"v2")==0){
        for (i=0;i<256*256*256;++i){
            antiO2 = component_delta2(i, i^0xffffff);
        }
    }

For the above with inlined component_delta2 I get
55ms vs 95ms not inlined, vs orig not inlined 167ms, FWIW.
My optimization reflex just got triggered, I didn't look at the
full post context to see if it might really be useful or not.

Regards,
Bengt Richter

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to