[Top][All Lists]

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

Re: Compilation to native

From: Matthew Mundell
Subject: Re: Compilation to native
Date: 22 Mar 2004 23:42:52 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Richard Stallman <address@hidden> writes:

>     (byte-compile 'silly-loop)
>     (silly-loop 100000000)
>     => ("Sat Feb 28 10:06:37 2004" "Sat Feb 28 10:06:53 2004")     ; 16 secs
>     (native-compile 'silly-loop)
>     (silly-loop 100000000)
>     => ("Sat Feb 28 10:17:13 2004" "Sat Feb 28 10:17:22 2004")     ; 9 secs
> I don't think that a speedup of less than a factor of 2 would be worth
> installing something that might take substantial maintenance effort.

The example may come within a factor of 2 with Fsub1 and Fgtr inlined
instead of called.  This depends on the proportion of time being spent
in set_internal.  I'll try it.

> However, it could be that this test is a bad test and doesn't really
> show the benefit of compilation.  Maybe this loop spends most of the
> time inside current-time-string.  How about trying something purely
> computational?

The loop _is_ purely computational.  The calls to current-time-string
are only to record the time before and after the loop.

(defun silly-loop (n)
  "Return time before and after N iterations of a loop."
  (let ((t1 (current-time-string)))
    (while (> (setq n (1- n))
        (list t1 (current-time-string))))

I think that this example favours the native compilation, as the
operations in the loop are relatively short.

>     The changes require NO_UNION_TYPE to be set, USE_LSB_TAG to be clear,
>     and EMACS_INT to be an int.
> It will be necessary to remove these restrictions to make it ready to
> install.  However, there's no harm working initially on this case
> and handling other cases later.

The change adds macros to lisp.h to deal with the differences
controlled by these settings.  Adding the other cases should simply
entail completing the macros for them.

reply via email to

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