On 6/23/2013 8:16 PM, Raymond Hettinger wrote:
> Yes, this is a micro-optimization.  In working on implementing
> deque slicing for 3.4, I restudied the block access patterns.   
> On an appendleft(), popleft() or extendleft() operation, the left link is
> accessed immediately before or after the leftmost entry in the data block. 
> The old struct arrangement can cause an unnecessary cache miss
> when jumping leftward.  This was something I overlooked when I
> originally wrote the code almost a decade ago.

A decade ago, cache lines were 64 bytes, pointers were 4 bytes, and
allocations were 16 byte aligned, so there could never be a cache miss.
Nowadays, cache lines are still 64 bytes but pointers are 8 bytes, and
we still allocating on 16 byte alignment, so you have a 25% chance of a
cache miss now.

-- 
Scott Dial
sc...@scottdial.com
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to