[CM] Performance of S7
Massimiliano Gubinelli
m.gubinelli at gmail.com
Thu Dec 31 07:45:32 PST 2020
Dear Bil,
> On 31. Dec 2020, at 15:13, bil at ccrma.stanford.edu <bil at ccrma.Stanford.EDU> wrote:
>
> I think the problem here is with-let -- it is blocking
> the normal optimizations that would otherwise speed
> up fib. Here is an ugly substitute:
>
> (let ((temp-value #f))
> (define *texmacs-module* (curlet))
> (define-macro (tm-define head . body)
> `(eval (list 'define ',head ', at body) *texmacs-module*))
>
> (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))))
>
> There has to be a prettier way to do it!
>
> with-let should not be so paranoid...
>
thanks, indeed it works for the small example. However the *real thing* still run as slow as before even with this replacement.
I've extracted the "real" tm-define and I attach a test case which indeed still show the slowness even using the "eval" trick.
I hope there is something to do about it. Even a trick would do, this is the only point in all the sources where I do some trickery with lets.
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20201231/a1a4930d/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fib4.scm
Type: application/octet-stream
Size: 27679 bytes
Desc: not available
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20201231/a1a4930d/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20201231/a1a4930d/attachment-0003.html>
More information about the Cmdist
mailing list