<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, 30 Aug 2016 at 11:56 Serhiy Storchaka <<a href="mailto:storchaka@gmail.com">storchaka@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 30.08.16 21:20, Antoine Pitrou wrote:<br>
> On Tue, 30 Aug 2016 18:12:01 +0000<br>
> Brett Cannon <<a href="mailto:brett@python.org" target="_blank">brett@python.org</a>> wrote:<br>
>>> Why not make it always a list?  List objects are reasonably cheap in<br>
>>> memory and access time... (unlike dicts)<br>
>><br>
>> Because I would prefer to avoid any form of unnecessary performance<br>
>> overhead for the common case.<br>
><br>
> But the performance overhead of iterating over a 1-element list<br>
> is small enough (it's just an array access after a pointer dereference)<br>
> that it may not be larger than the overhead of the multiple tests and<br>
> conditional branches your example shows.<br>
<br>
Iterating over a tuple is even faster. It needs one pointer dereference<br>
less.<br></blockquote><div><br></div><div>I'll talk it over with Dino and see what he thinks.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
And for memory efficiency we can use just a raw array of pointers.<br></blockquote><div><br></div><div>I would rather not do that as that leads to having to track the end of the array, special memory cleanup, etc. </div></div></div>