> On 18 Jun 2020, at 22:28, Steven D'Aprano <st...@pearwood.info> wrote:
> 
> On Thu, Jun 18, 2020 at 06:49:13PM +0100, Barry Scott wrote:
> 
>> The key part of the idea is that the memory holding the ref count is 
>> not adjacent to the memory holding the objects state. Further that 
>> rarely modified state should be kept away from usually modified state.
> 
> Isn't that going to play havoc with modern CPU pipelines and 
> pre-fetching?

Not for instructions no. 

> Every time a function is called, there will be 
> cache-misses galore and performance plummets?

Is there? Whats to say that all the memory that is involved is not in
cache-lines in the cache?

I cannot guess what the performance will be. I'd need to ran
performance tests to see what happens.

> 
> I know very little about how this works except a vague rule of thumb 
> that in the 21st century memory locality is king. If you want code to be 
> fast, keep it close together, not spread out.

Remember that the caches are large these days and can hold many cache lines.
So the idea of local really means is in the cache.

If this idea works then I think the winner will be apps that fork lots child 
processes
that will not modify memory setup by the parent. In other words, while this is
an interest thought experiment, I think its not going to help single process 
python
programs.

The patch set that Guido hilighted is from just such an App.

> 
> https://stackoverflow.com/questions/16699247/what-is-a-cache-friendly-code
> 
> When I'm programming at the Python level I don't need to worry about any 
> of this (and in fact I can't do anything about it), but I expect that 
> for the C implementation, that will be pretty critical.

Indeed.

Barry


> 
> 
> -- 
> Steven
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-ideas@python.org/message/JN4ABC4TEPODGRKQL4B7MHUHUW7NFDJD/
> Code of Conduct: http://python.org/psf/codeofconduct/
> 
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/RA4BFXH2BGIBCMVIDPWJ65GU224Z3TZD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to