[CM] Performance of S7
Massimiliano Gubinelli
m.gubinelli at gmail.com
Thu Dec 31 03:44:11 PST 2020
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?
Thanks a lot,
Max
> On 31. Dec 2020, at 12:20, Massimiliano Gubinelli <m.gubinelli at gmail.com> wrote:
>
> Ok, I've got some clue.
>
> In TeXmacs we have a system to define "global" functions which is implemented via a macro "tm-define". If I run a stadard (fib 40) benchmark then it takes 2-3 sec, but if I define the fibonacci funciton via tm-define then it takes 20 sec! This could account for the sluggish performance since essentially all the core functionality is implemented via tm-defines...
>
> Any suggestions to make it faster, or why it is so slow? In the very basic case tm-define just make a define in a let environment which is visible in all modules (see TeXmacs/progs/kernel/boot-s7.scm for the definition of the module system and TeXmacs/progs/texmacs/tm-define.scm for the definition of tm-define)
>
> Best,
> Max
>
>
>
>> On 31. Dec 2020, at 11:23, Massimiliano Gubinelli <m.gubinelli at gmail.com> wrote:
>>
>> I'm very surprised too, I've run some of the standard benchmarks on my machine and so far s7 is either on par with Guile 1.8 or much better.
>>
>> It could be some problem in the way I embed it? Or the fact that I load all the code in a sublet of the rootlet? (I implemented on S7 a module system similar to that that Guile has)
>>
>> I will try to run some of the benchmarks inside the embedded S7 to see if the situation is different there.
>>
>> Thanks for the help, anyway.
>>
>> Max
>>
>>
>>> On 31. Dec 2020, at 01:21, bil at ccrma.stanford.edu <bil at ccrma.Stanford.EDU> wrote:
>>>
>>>> Does this tell you something?
>>>
>>> Those functions should not be taking any time at all. I'll
>>> have to try to build TeXmacs and take a look at this.
>>> I might not get around to it until sometime next week.
>>>
>>
>
More information about the Cmdist
mailing list