A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-February/138374.html below:

[Python-Dev] cpython: Improve struct cache locality by bring commonly accessed fields close together.

[Python-Dev] cpython: Improve struct cache locality by bring commonly accessed fields close together. [Python-Dev] cpython: Improve struct cache locality by bring commonly accessed fields close together.Antoine Pitrou solipsis at pitrou.net
Fri Feb 20 11:47:09 CET 2015
On Fri, 20 Feb 2015 08:50:10 +0000
raymond.hettinger <python-checkins at python.org> wrote:
> https://hg.python.org/cpython/rev/0ba4bcc0a7a6
> changeset:   94696:0ba4bcc0a7a6
> user:        Raymond Hettinger <python at rcn.com>
> date:        Fri Feb 20 00:50:04 2015 -0800
> summary:
>   Improve struct cache locality by bring commonly accessed fields close together.
> 
> files:
>   Modules/_randommodule.c |  2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
> 
> 
> diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
> --- a/Modules/_randommodule.c
> +++ b/Modules/_randommodule.c
> @@ -78,8 +78,8 @@
>  
>  typedef struct {
>      PyObject_HEAD
> +    int index;
>      unsigned long state[N];
> -    int index;
>  } RandomObject;

I may be missing something something, but I don't see how that improves
cache locality. The index is only ever looked up when the state is also
looked up, and since the state is used sequentially there are equal
chances for the state lookup to be near the end rather than near the
front.

Regards

Antoine.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4