lkml.org 
[lkml]   [2008]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Improved Swaping Method In sort.c
From
Date
Soumyadip Das Mahapatra <dip_kernel@yahoo.co.in> writes:

> But this code saves memory equaling two integers. What about that ?

It won't because the compiler uses registers not memory for the
temporary of course. In fact your version will cause more memory
accesses because the compiler doesn't know that a and b do not alias
each other, so it cannot cache the immediate value and has to always
go through memory. The difference will not be large on x86 because L1
cache accesses are reasonably fast, but they're still much slower than
a register access.

-Andi


\
 
 \ /
  Last update: 2008-04-30 20:21    [W:0.026 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site