emacs-devel
[Top][All Lists]
Advanced

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

Re: In support of guile-emacs


From: Taylan Ulrich Bayırlı/Kammer
Subject: Re: In support of guile-emacs
Date: Tue, 20 Oct 2015 22:09:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

> [...]
>
>> (let loop ((i 0) (s 0))
>>   (if (<= i 10000000)
>>       (loop (+ i 1) (+ s i))
>>       (format #t "~s" s)))
>
>> Takes about 0.50s.
>
> So, we're talking about a speed up of around 13%/25% on a simple loop
> test, depending on whether or not an idiomatic Scheme formulation is
> used.  Given that Guile compiled elisp wouldn't be optimised in this way,
> it would guess that the 13% is nearer the mark.  But it would take a few
> real life tests to measure this better.

Indeed, I don't think any conclusions should be drawn from this.

>> BTW here's a timing function that automatically byte-compiles the
>> argument (side-effectfully if a symbol):
>
>> (defun time (function)
>>   "Return execution time of calling FUNCTION in seconds as a
>> float.  FUNCTION is byte-compiled automatically."
>>   (setq function (byte-compile function))
>>   (let ((start (current-time)))
>>     (funcall function)
>>     (let ((end (current-time)))
>>       (let ((time (time-subtract end start)))
>>         (+ (* (nth 0 time) (expt 2 16))
>>            (nth 1 time)
>>            (/ (nth 2 time) 1000000.0))))))
>
> Hint: there's a function `float-time' which does the job adequately, and
> is easier to manipulate.  For comparison, here's my `time-it' macro
> (which doesn't itself do byte compilation):
>
> (defmacro time-it (&rest forms)
>   "Time the running of a sequence of forms using `float-time'.
> Call like this: \"M-: (time-it (foo ...) (bar ...) ...)\"."
>   `(let ((start (float-time)))
>     ,@forms
>     (- (float-time) start)))
>
> [ .... ]

Oh neat.  I forgot we had float-time.

>> > If Guile Emacs is advanced enough, timing the fontification of a file
>> > (say, ..../src/xdisp.c in our repository) would be a very meaningful
>> > timing.
>
>> I'm guessing that Guile Emacs isn't ready for that yet but, how can one
>> time that?
>
> Start by unfontifying the entire file, then scroll through it, fontifying
> a screen at a time.  (sit-for 0) is used to ensure fontification at each
> stage.  So something like this (untested) would do the job:
>
> (defun fully-fontify ()
>   (beginning-of-buffer)
>   (font-lock-mode 0)
>   (font-lock-mode 1)
>   (condition-case nil
>     (while t
>       (sit-for 0)
>       (scroll-up))))
>
> The `condition-case' catches the error thrown when `scroll-up' reaches
> the end of the buffer.

I had to add the handler `(error nil)' to that, then it worked.

GuileEmacs would first refuse to open xdisp.c, which I thought was a new
feature, but ultimately it opened it. :-)

This is comparing release Emacs to (pre?) alpha GuileEmacs so it
shouldn't come as a surprise (and I didn't care to normalize for X
toolkit) but here goes:

 36.5 seconds with stock Emacs 24.5.1 with no X toolkit from Guix
169.6 seconds with Guile Emacs master branch with GTK from Guix

I think the main problem is a bug that leaks tons of memory and thus
leads to long GC pauses, because GuileEmacs would pause for long times
and reached 700 MB residential memory after it was done.


Since I seem incapable of cooperating with several people on emacs-devel
on typical development topics (see recent drama ... or don't), I guess I
could just devote all my Emacs-related efforts to Guile Emacs.  I still
have a bunch of non-Emacs projects running in parallel though, and I
don't know if I have the Guile *or* Emacs related skills to hack on
this, so don't keep your hopes high.

Taylan



reply via email to

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