[racket] generator performance

From: John Clements (clements at brinckerhoff.org)
Date: Tue Sep 18 12:59:23 EDT 2012

On Sep 18, 2012, at 5:28 AM, Matthew Flatt wrote:

> I don't think the parameter overhead is relevant. In Jay's post, he
> performs 100k parameter accesses, and it takes 16 milliseconds; we can
> reasonably extrapolate 160 msec for 1M accesses. Patrick's generator
> example yields 1M times, and takes 18 seconds --- 100x the parameter
> overhead.
> 
> I agree with others that the cost of capturing continuations is the
> culprit in this case. The run-time system has support for faster
> continuations that work in constrained settings (currently used to
> implement futures), and it might be possible to make those
> continuations kick in work for a typical generator, but I'm not sure.
> 
> Meanwhile, it might be interesting to try implementing a `generator'
> form that rewrites its body to implement `yield's that are
> syntactically apparent (after local-expansion), leaving parameter and
> continuations to handle the general case.

+1! +1!

I'm sure this idea flitted through about twenty minds yesterday.

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4800 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120918/2a6bc46a/attachment.p7s>

Posted on the users mailing list.