Author ncoghlan
Recipients eric.smith, inada.naoki, ncoghlan, rhettinger, serhiy.storchaka, xiang.zhang
Date 2016-11-11.04:40:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1478839220.04.0.365328865304.issue28638@psf.upfronthosting.co.za>
In-reply-to
Content
I'll echo Raymond's concerns here, as we simply don't have the collective maintenance capacity to sustain a plethora of special case micro-optimisations aimed at avoiding importing common standard library modules.

I will note however, that there has been relatively little work done on optimising CPython's code generator, as the use of pyc files and the fact namedtuples are typically only defined at start-up already keeps it out of the critical path in most applications.

While work invested there would technically still be a micro-optimisation at the language level, it would benefit more cases than just avoiding the use of namedtuple in functools would.

Alternatively, rather than manually duplicating the namedtuple code and having to keep it in sync by hand, you could investigate the work Larry Hastings has already done for Argument Clinic in Python's C files: https://docs.python.org/3/howto/clinic.html

Argument Clinic already includes the machinery necessary to assist with automated maintenance of generated code (at least in C), and hence could potentially be adapted to the task of "named tuple inlining". If Victor's AST transformation pipeline and function guard proposals in PEP's 511 and 510 are accepted at some point in the future, then such inlining could potentially even be performed implicitly some day.

Caring about start-up performance is certainly a good thing, but when considering potential ways to improve the situation, structural enhancements to the underlying systems are preferable to ad hoc special cases that complicate future development efforts.
History
Date User Action Args
2016-11-11 04:40:20ncoghlansetrecipients: + ncoghlan, rhettinger, eric.smith, inada.naoki, serhiy.storchaka, xiang.zhang
2016-11-11 04:40:20ncoghlansetmessageid: <1478839220.04.0.365328865304.issue28638@psf.upfronthosting.co.za>
2016-11-11 04:40:20ncoghlanlinkissue28638 messages
2016-11-11 04:40:18ncoghlancreate