I was told that for Python 2.5 nametuples "emulation" is 8 times
slower than regular tuples and dicts.
That's why I'm interested in benchmarks. If it's significantly slower
(at least for Python 2.4 and 2.5), this should be mentioned in docs.

On Mon, Jul 4, 2011 at 5:19 PM, Paul Miller <paulmi...@me.com> wrote:
> Hi Yuri,
>
> I have not tested them for speed, but:
>
> - Named tuples have no instance dictionary, so their instances take no more 
> space than a regular tuple (for example, casting thousands of sql records to 
> named tuples has zero memory overhead).
> - They also use C-speed attribute lookup using property() and itemgetter()
>
> I don’t really think that speed of collection (which is built into python 
> 2.6+) is much slower than dicts etc.
>
>
> On Jul 4, 2011, at 7:41 AM, burc...@gmail.com wrote:
>
>> Hi Paul,
>>
>> Is it correct that nametuple construction is much slower than for
>> normal ones or is this true only in older python versions?
>>
>> On Mon, Jul 4, 2011 at 1:47 AM, paulpmillr <paulpmi...@gmail.com> wrote:
>>> Hello.
>>>
>>> I've added an implementation for named tuples query set, see
>>> https://code.djangoproject.com/ticket/15648
>>>
>>> - Named tuples could be iterated over with order saving (like lists /
>>> tuples).
>>> - Properties there could be accessed with dot notation - post.topic
>>> (almost like dicts).
>>> - They could be converted both to dicts and lists
>>> - Easy debugging (pros over queryset.deferred())
>>> - I've provided a fallback implementation of named tuple for python
>>> 2.5 users
>>> - Tests are there too.
>>>
>>> Named tuples eliminate neediness in values & values_list because they
>>> have all their features.
>>>
>>> What do you think about it?
>>
>> --
>> Best regards, Yuri V. Baburov, Skype: yuri.baburov, MSN: bu...@live.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers" group.
>> To post to this group, send email to django-developers@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-developers+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-developers?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-developers?hl=en.
>
>



-- 
Best regards, Yuri V. Baburov, Skype: yuri.baburov, MSN: bu...@live.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to