Author Sergey
Recipients Ramchandra Apte, Sergey, aleax, ethan.furman, jcea, oscarbenjamin, rhettinger, serhiy.storchaka, terry.reedy
Date 2013-07-16.02:07:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1373940475.28.0.245690364485.issue18305@psf.upfronthosting.co.za>
In-reply-to
Content
> This is not a common case. A common case is creating short tuples and keeping a lot of tuples in memory.

> For fast += you need keep not only a size of tuple, but also a size of allocated memory. It's a cause of sys.getsizeof([1, 2]) > sys.getsizeof((1, 2)).

Agree. But is it worth worrying about? How much RAM could be taken by it? E.g. python test uses ~30000 tuples in peak. So if we add e.g. 32 bytes to tuple then python test would use 106MB of RAM instead of 105MB. 1%? ;)

> You shouldn't optimize a rare case at the cost of regression in common usage.

This could optimize many cases, like instant tuple copy, or instant conversions of lists to tuples and back, if this idea is extended to lists. It may also work for strings.
History
Date User Action Args
2013-07-16 02:07:55Sergeysetrecipients: + Sergey, aleax, rhettinger, terry.reedy, jcea, ethan.furman, Ramchandra Apte, serhiy.storchaka, oscarbenjamin
2013-07-16 02:07:55Sergeysetmessageid: <1373940475.28.0.245690364485.issue18305@psf.upfronthosting.co.za>
2013-07-16 02:07:55Sergeylinkissue18305 messages
2013-07-16 02:07:54Sergeycreate