[CM] Performance of S7
Kjetil Matheussen
k.s.matheussen at gmail.com
Thu Dec 31 04:01:25 PST 2020
On Thu, Dec 31, 2020 at 12:49 PM Massimiliano Gubinelli
<m.gubinelli at gmail.com> wrote:
>
> Dear Bil,
>
> I've isolated what seems to be the problem in a test case:
>
> (let ((temp-value #f))
> (define *texmacs-module* (curlet))
> (define-macro (tm-define head . body)
> `(begin
> (set! temp-value , at body)
> (with-let *texmacs-module*
> (define ,head temp-value))))
> (let ()
> (tm-define fib (lambda (n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))))
>
> (let ((n 40))
> (format *stdout* "(fib ~A) : ~A \n" n (fib n))))
>
>
> This program takes ~35sec while a normal fib takes 3 sec on my machine. Any idea why and how to solve this problem?
>
In S7, "define-expansion" works more like "define-macro" other scheme
implementations.
I might oversimplify now, but define-macro expands during run-time,
while define-expansion expands during compile-time.
More information about the Cmdist
mailing list