<div dir="auto"><div>Can you try across a range of tuple sizes? E.g. what about with 100 items? 1000?<br><div class="gmail_extra"><br><div class="gmail_quote">On Jul 17, 2017 7:56 PM, "Ethan Furman" <<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On 07/17/2017 06:34 PM, Steven D'Aprano wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Mon, Jul 17, 2017 at 05:01:58PM -0700, Ethan Furman wrote:<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Guido has decreed that namedtuple shall be reimplemented with speed in mind.<br>
<br>
I haven't timed it (I'm hoping somebody will volunteer to be the bench mark<br>
guru), I'll offer my NamedTuple implementation from my aenum [1] library.<br>
</blockquote>
<br>
With respect Ethan, if you're going to offer up NamedTuple as a faster<br>
version of namedtuple, you should at least do a quick proof of<br>
concept to demonstrate that it actually *is* faster.<br>
</blockquote>
<br></div>
I suck at benchmarking, so thank you for providing those quick-and-dirty hints.<div class="quoted-text"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Full bench marking<br>
can wait, but you should be able to do at least something like:<br>
<br>
<br>
python3 -m timeit --setup "from collections import namedtuple" \<br>
     "K = namedtuple('K', 'a b c')"<br>
</blockquote>
<br></div>
546 usec<div class="quoted-text"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
versus<br>
<br>
python3 -m timeit --setup "from aenum import NamedTuple" \<br>
     "K = NamedTuple('K', 'a b c')"<br>
</blockquote>
<br></div>
250 usec<br>
<br>
<br>
So it seems to be faster!  :)<br>
<br>
It is also namedtuple compatible, except for the _source attribute.<br>
<br>
--<br>
~Ethan~<div class="elided-text"><br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</div></blockquote></div><br></div></div></div>