[Python-Dev] Impact of Namedtuple on startup time

Ivan Levkivskyi levkivskyi at gmail.com
Mon Jul 17 09:03:26 EDT 2017


Interesting coincidence, just two days ago I have heard that a team at one
large company completely abandoned namedtuple because of the creation time
problem.

Concerning _source, why it is not possible to make it a property so that
all the string formatting will happen on request, thus saving some time for
users who doesn't need it?
(Of course this will not be an actual source, but it can be made
practically equivalent to the no-compile version.)

--
Ivan


On 17 July 2017 at 14:53, Antoine Pitrou <solipsis at pitrou.net> wrote:

> On Mon, 17 Jul 2017 14:43:19 +0200
> Antoine Pitrou <solipsis at pitrou.net> wrote:
> > Hello,
> >
> > Cost of creating a namedtuple has been identified as a contributor to
> > Python startup time.
>
> Imprecise wording: that's the cost of creating a namedtuple *class*,
> i.e. anytime someone writes `MyClass = namedtuple('MyClass', ...)`.
>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> levkivskyi%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170717/e6beb8ed/attachment-0001.html>


More information about the Python-Dev mailing list