Re: optimizing lazy sequences: srfi-41 vs delayed continuation with values + promise vs delayed continuation with cons + lambda

2018-03-02 Thread Mark H Weaver
Hi, Amirouche Boubekki writes: [...] > Now, I got another idea what if I replace the 'cons' returned > by the traversi procedures by 'values' and replace the > lambda with 'delay' with some use of 'force' at the correct > places. It will result in the following procedures: > > (define-public (lis

Re: optimizing lazy sequences: srfi-41 vs delayed continuation with values + promise vs delayed continuation with cons + lambda

2018-02-25 Thread Amirouche Boubekki
(define (lazyseq-with-stream) (list->stream (iota max))) This is wrong. It must be implemented as: (define-stream (lazyseq-with-stream) (stream-let loop ((v 1)) (stream-cons v (loop (+ 1 v) I get the same segfault with the following error: Too many heap sections: Increa

Re: optimizing lazy sequences: srfi-41 vs delayed continuation with values + promise vs delayed continuation with cons + lambda

2018-02-25 Thread Amirouche Boubekki
I figured how to benchmark this. Here are the timings: promise: 43s lambda: 7s And at the current 'max' value the srfi-41 streams can't complete the benchmark with this error: Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS Here is the benchmark program: (use-modules (srfi srfi

Re: optimizing lazy sequences: srfi-41 vs delayed continuation with values + promise vs delayed continuation with cons + lambda

2018-02-25 Thread Amirouche Boubekki
On 2018-02-25 15:16, Amirouche Boubekki wrote: Hello all, I know it's not good to optimize first, but I got into it and now I need to know. A few months ago, I created a lazy sequence library that retains history based on delayed continuation, it can be summarized as follow: (define-public (li

optimizing lazy sequences: srfi-41 vs delayed continuation with values + promise vs delayed continuation with cons + lambda

2018-02-25 Thread Amirouche Boubekki
Hello all, I know it's not good to optimize first, but I got into it and now I need to know. A few months ago, I created a lazy sequence library that retains history based on delayed continuation, it can be summarized as follow: (define-public (list->traversi lst) (let loop ((lst lst)) (l