--- On Tue, 1/26/10, Antoine Pitrou <solip...@pitrou.net> wrote: > From: Antoine Pitrou <solip...@pitrou.net> > Subject: Re: [Python-Dev] patch to make list.pop(0) work in O(1) time > To: python-dev@python.org > Date: Tuesday, January 26, 2010, 12:50 AM > Terry Reedy <tjreedy <at> > udel.edu> writes: > > > > The idea that CPython should not be improved because > it would spoil > > programmers strikes me as a thin, even desparate > objection. One could > > say that same thing about the recent optimization of > string += string so > > that repeated concats are O(n) instead of O(n*n). > > Note that it's not even generally true. It only works if > your platform's > realloc() is sufficiently smart. That's why we once have > had some > Windows-specific performance problems in the py3k IO > module. >
One thing that has struck me in working on the O(1) patch is that almost all of my code would be unneeded if C's memory manager were just smart enough to allow you to release memory off the top of a chunk equally as efficiently as releasing it off the bottom of a chunk. It's not like memory is asymmetrical; it's just the 1980's C interface for memory management that makes us think we can only extend and shrink in one direction. The memory management paradigm that CPython builds on top of is at least a quarter century outdated, as far as I am concerned. It might even go back to the 1970s. It's not Python's fault that OSes or compilers have not modernized their approach to memory management, but I do think there will come a time, maybe 25 years from now, when CPython says enough is enough, it's time to treat memory like it's extendible and shrinkable in two directions. _______________________________________________ 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