On Mon, Mar 16, 2009 at 09:16:01AM -0400, Jonathan S. Shapiro wrote: > There are good *performance* reasons to zero at allocation time: it > eliminates memory reads (CLZ == Cache Line Zero).
Huh; a neat and somewhat obvious optimization now you point it out! Which architecture is that? I can only find CLZ meaning "count leading zeros" which I don't think is correct. DCBZ looks like the instruction for Power CPUs[1] and there are suggestions that using REP STOSL may[2] do the same thing for Intel IA32 processors but I've not found anything definite in the docs from Intel that I could find. Couldn't find much for ARM CPUs either. > In any case, uninitialized data is just not okay for any reason. Agreed for all cases where getting a correct answer is important! I remember reading about a compression scheme (I think it was LZ based, maybe LZO[3]) that was deliberately *not* zeroing its dictionary for performance reasons. It would be interesting to see if they knew that zeroing memory can result in faster execution than not; the test cases that come with the software are complicated by the non-determinism resulting from not initializing things. -- Sam http://samason.me.uk/ [1] http://www.ibm.com/developerworks/power/library/pa-memory/index.html [2] http://gcc.gnu.org/ml/gcc/2008-08/msg00058.html [3] http://www.oberhumer.com/opensource/lzo/ _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
