[openstack-dev] [all][python3] use of six.iteritems()

Mike Bayer mbayer at redhat.com
Thu Jun 11 17:46:52 UTC 2015



On 6/11/15 1:39 PM, Dolph Mathews wrote:
>
> On Thu, Jun 11, 2015 at 12:34 AM, Robert Collins 
> <robertc at robertcollins.net <mailto:robertc at robertcollins.net>> wrote:
>
>     On 11 June 2015 at 17:16, Robert Collins
>     <robertc at robertcollins.net <mailto:robertc at robertcollins.net>> wrote:
>
>     > This test conflates setup and execution. Better like my example,
>     ...
>
>     Just had it pointed out to me that I've let my inner asshole out again
>     - sorry. I'm going to step away from the thread for a bit; my personal
>     state (daughter just had a routine but painful operation) shouldn't be
>     taken out on other folk, however indirectly.
>
>
> Ha, no worries. You are completely correct about conflating setup and 
> execution. As far as I can tell though, even if I isolate the dict 
> setup from the benchmark, I get the same relative differences in 
> results. iteritems() was introduced for a reason!
>
> If you don't need to go back to .items()'s copy behavior in py2, then 
> six.iteritems() seems to be the best general purpose choice.
I am firmly in the "let's use items()" camp.  A 100 ms difference for a 
totally not-real-world case of a dictionary 1M items in size is no kind 
of rationale for the Openstack project - if someone has a dictionary 
that's 1M objects in size, or even 100K, that's a bug in and of itself.

the real benchmarks we should be using, if we are to even bother at all 
(which we shouldn't), is to observe if items() vs. iteritems() has *any* 
difference that is at all measurable in terms of the overall execution 
of real-world openstack use cases.   These nano-differences in speed are 
immediately dwarfed by all those operations surrounding them long before 
we even get to the level of RPC overhead.



>
> I think Gordon said it best elsewhere in this thread:
>
> > again, i just want to reiterate, i'm not saying don't use items(), i 
> just think we should not blindly use items() just as we shouldn't 
> blindly use iteritems()/viewitems()
If a demonstrable difference can be established in terms of real-world 
use cases for code that is using iteritems() vs. items(), then you can 
justify this difference.  Otherwise, not worth it.




>
>     -Rob
>
>     --
>     Robert Collins <rbtcollins at hp.com <mailto:rbtcollins at hp.com>>
>     Distinguished Technologist
>     HP Converged Cloud
>
>     __________________________________________________________________________
>     OpenStack Development Mailing List (not for usage questions)
>     Unsubscribe:
>     OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>     <http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe>
>     http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
>
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150611/44c5062b/attachment.html>


More information about the OpenStack-dev mailing list