[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87fxt3gqbx.fsf@basil.nowhere.org>
Date: Wed, 30 Apr 2008 20:17:22 +0200
From: Andi Kleen <andi@...stfloor.org>
To: Soumyadip Das Mahapatra <dip_kernel@...oo.co.in>
Cc: linux-kernel@...r.kernel.org
Subject: Re: Improved Swaping Method In sort.c
Soumyadip Das Mahapatra <dip_kernel@...oo.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists