Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Dev

Change to yield-from implementation

 

 

Python dev RSS feed   Index | Next | Previous | View Threaded


greg.ewing at canterbury

Apr 9, 2012, 5:24 AM

Post #1 of 4 (104 views)
Permalink
Change to yield-from implementation

Mark Shannon wrote:

> We have recently removed the f_yieldfrom field from the frame object.
> (http://bugs.python.org/issue14230)

Hey, wait a minute. Did anyone consider the performance effect
of that change on deeply nested yield-froms?

The way it was, a yield-from chain was traversed by a very
tight C loop that found the end frame and resumed it directly.
If I understand what you've done correctly, now it has to
enter and execute a bytecode in every frame along the way.

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


solipsis at pitrou

Apr 9, 2012, 5:46 AM

Post #2 of 4 (95 views)
Permalink
Re: Change to yield-from implementation [In reply to]

On Tue, 10 Apr 2012 00:24:07 +1200
Greg Ewing <greg.ewing [at] canterbury> wrote:
> Mark Shannon wrote:
>
> > We have recently removed the f_yieldfrom field from the frame object.
> > (http://bugs.python.org/issue14230)
>
> Hey, wait a minute. Did anyone consider the performance effect
> of that change on deeply nested yield-froms?

What's the point? Apart from naïve toy examples of traversing trees, I
don't think "deeply nested yield-froms" are likely to be
performance-critical.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


benjamin at python

Apr 9, 2012, 5:46 AM

Post #3 of 4 (97 views)
Permalink
Re: Change to yield-from implementation [In reply to]

2012/4/9 Greg Ewing <greg.ewing [at] canterbury>:
> Mark Shannon wrote:
>
>> We have recently removed the f_yieldfrom field from the frame object.
>> (http://bugs.python.org/issue14230)
>
>
> Hey, wait a minute. Did anyone consider the performance effect
> of that change on deeply nested yield-froms?
>
> The way it was, a yield-from chain was traversed by a very
> tight C loop that found the end frame and resumed it directly.
> If I understand what you've done correctly, now it has to
> enter and execute a bytecode in every frame along the way.

I think correctness is more important that performance, though.



--
Regards,
Benjamin
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com


guido at python

Apr 9, 2012, 7:57 AM

Post #4 of 4 (90 views)
Permalink
Re: Change to yield-from implementation [In reply to]

On Mon, Apr 9, 2012 at 5:46 AM, Antoine Pitrou <solipsis [at] pitrou> wrote:
> On Tue, 10 Apr 2012 00:24:07 +1200
> Greg Ewing <greg.ewing [at] canterbury> wrote:
>> Mark Shannon wrote:
>>
>> > We have recently removed the f_yieldfrom field from the frame object.
>> > (http://bugs.python.org/issue14230)
>>
>> Hey, wait a minute. Did anyone consider the performance effect
>> of that change on deeply nested yield-froms?
>
> What's the point? Apart from naïve toy examples of traversing trees, I
> don't think "deeply nested yield-froms" are likely to be
> performance-critical.

I agree with Benjamin that correctness trumps performance, but I'd
also like to point out that there are other use cases besides nested
iterators. If this gets used for coroutines it may not be so unusual
to have a stack of nested things with on top one that loops a lot --
if each iteration incurs cost proportional to how it got there this
may be a problem. But, correctness first.

--
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
Python-Dev [at] python
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com

Python dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.