[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] TeXmacs with S7 Scheme

From: Massimiliano Gubinelli
Subject: Re: [Texmacs-dev] TeXmacs with S7 Scheme
Date: Thu, 31 Dec 2020 10:48:43 +0100

Dear all,

On 31. Dec 2020, at 10:27, TeXmacs <texmacs@lix.polytechnique.fr> wrote:

Hi Max,

Thanks for your work on S7.  It is interesting that you managed to get that working,
although a bit disappointing that there is no performance improvement.

On Wed, Dec 30, 2020 at 11:40:36AM +0100, Massimiliano Gubinelli wrote:
Hi all,
Just to have some comparison metrics in this discussion, I've tried to run this program

(define (fib n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))
(display (fib 40))

on my machine (MacBook Air 2019) for Guile 1.8, Guile 2.2.7, Guile 3.0.4 and S7, this are the results:
Guile 1.8.8 : 40.595 sec
Guile 2.2.7 : 8.102 sec
Guile 3.0.4 : 3.864 sec
S7 : 3.297 sec

The results for Guile2/3 are from the compiled code (excluding the compilation time). If we force Guile2/3 to use only the interpreter (with GUILE_AUTO_COMPILE=0 and clean cache) we have

Guile 2.2.7: 120 sec
Guile 3.0.4: 60 sec

So, S7 seems a quite fast interpreter and also the benchmark shows the situation in Guile-land. For some reason however, our use-case is not fully captured by this benchmark.

It would be interesting to explain the timings.

Could it be that the slowness of S7 for our application is due to
some limited kind of pre-compilation taking place in S7?

The Fibonacci example is so small that you won't notice the overhead
due to precompilation.  For a real world application like TeXmacs,
one of the main bottlenecks is startup time, which basically boils
down to a lot of file loads, parsing and function declarations.
If we would like to make this more efficient, then we would need
some kind of cache for (pre-)compilation.  I guess that this is where
Guile 3 might one day be interesting (modulo all the other drawbacks).

I think S7 is optimized but does not do precompilation (all the system is in *one* C file without any additional scheme support file), ideal for embedding. It is missing some utility functions  but I think this is not a problem in our project: we can always implement them in the glue and export to the scheme.

  I've not given up on S7. I'm actually quite surprised is not more well know (but well, TeXmacs isn't either...) I've run a standard scheme benchmark suite (https://ecraven.github.io/r7rs-benchmarks) and the results are astounding I will report them later on when I finish checking also Guile 1.8 which for the moment runs much slower. These are the partial results so far:



the relevant number is the last which is the time in second, the other numbers identify the parameters in that particular benchmark. You can see there are sometime huge improvements on Guile 1.8 and is never much slower.

I'm investigating a bit more what is going on in TeXmacs, maybe I do something which prevents some optimizations. I've contacted the developer which seems wanting to help. S7 seems to me a very solid project: long history, used in well known music software (for algorithmic composition, Snd editor, Common Music framework).


Best wishes, --Joris

Texmacs-dev mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]