A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-November/122686.html below:

[Python-Dev] performance of {} versus dict()

[Python-Dev] performance of {} versus dict() [Python-Dev] performance of {} versus dict()Benjamin Peterson benjamin at python.org
Wed Nov 14 14:43:18 CET 2012
2012/11/14  <martin at v.loewis.de>:
>
> Zitat von Chris Withers <chris at simplistix.co.uk>:
>
>
>> a_dict = dict(
>>     x = 1,
>>     y = 2,
>>     z = 3,
>>     ...
>>     )
>
>
>> What can we do to speed up the former case?
>
>
> It should be possible to special-case it. Rather than creating
> a new dictionary from scratch, one could try to have the new dictionary
> the same size as the original one, and copy all entries.
>
> I also wonder whether the PyArg_ValidateKeywordArguments call is really
> necessary: if this is not a proper keyword dictionary, dict creation
> could still proceed in a reasonable way.

In the common case PyArg_ValidateKeywordArguments should be a simple check.



-- 
Regards,
Benjamin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4