Thanks Rodolfo,
I did some further experiments which confirm your results. I noticed that
results vary quite a bit run to run so I ran several times from clean and
took the median:
prime-pi/acc 400 with original make-coroutine:
cpu time: 2808 real time: 2879 gc time: 1000
prime-pi/acc 40
Hello Joe,
2012/2/22 Joe Gilray
> Hi Matthew,
>
> Thanks for your help. I really can't even pretend to understand the
> make-coroutine code but this is what I'm seeing:
>
> Original make-coroutine, without stream-ref pre-call => out of memory
> (1GB) when running (prime-pi 50)
>
I tried
Hi Matthew,
Thanks for your help. I really can't even pretend to understand the
make-coroutine code but this is what I'm seeing:
Original make-coroutine, without stream-ref pre-call => out of memory (1GB)
when running (prime-pi 50)
Original make-coroutine, with stream-ref pre-call => runs (p
I don't know the answer, but here's a piece of the puzzle that might be
relevant.
Try this alternate `make-coroutine':
(define (make-coroutine fn)
(let ([cont #f])
(λ ()
(call-with-continuation-prompt
(lambda ()
(if cont
(cont)
(
Hi,
I created an infinite stream of primes (using this interesting article:
http://matthias.benkard.de/journal/116)
I tried to create a prime-pi function:
(define (prime-pi n)
(let loop-count ([candidate-stream prime-stream])
(if (> (stream-first candidate-stream) n)
0
5 matches
Mail list logo