From: Matthew Mundell <matt@mundell.ukfsn.org>
Cc: emacs-devel@gnu.org
Subject: Re: Compilation to native
Date: 30 Mar 2004 23:18:03 +0100 [thread overview]
Message-ID: <87k712gesk.fsf@sno.mundell.ukfsn.org> (raw)
In-Reply-To: E1B5q0i-0003DQ-1P@fencepost.gnu.org
Richard Stallman <rms@gnu.org> writes:
> The loop _is_ purely computational.
>
> I was fooled by the indentation, which makes it appear
> that the call to current-time-string is inside the loop.
> See?
>
> (defun silly-loop (n)
> "Return time before and after N iterations of a loop."
> (let ((t1 (current-time-string)))
> (while (> (setq n (1- n))
> 0))
> (list t1 (current-time-string))))
>
> Anyway, such a small speedup is not worth the trouble.
> Compilation of CCL may be worth while. Or optimization
> of the CCL interpreter may be possible.
This is for the record, at least. The speedup is a little better with
Fgtr inlined into the native, a few excess memory instructions saved,
and, where possible, objects passed between byte operations using
registers instead of the stack.
Byte compiled:
("Tue Mar 30 21:54:05 2004" "Tue Mar 30 21:54:21 2004") 16 s
("Tue Mar 30 21:54:26 2004" "Tue Mar 30 21:54:42 2004") 16 s
("Tue Mar 30 21:54:45 2004" "Tue Mar 30 21:55:01 2004") 16 s
Compiled from byte code to native:
("Tue Mar 30 21:55:43 2004" "Tue Mar 30 21:55:49 2004") 6 s
("Tue Mar 30 21:55:51 2004" "Tue Mar 30 21:55:58 2004") 7 s
("Tue Mar 30 21:56:01 2004" "Tue Mar 30 21:56:07 2004") 6 s
There is the possibility of further improvement, especially for this
example, by moving Lisp object referencing and setting out of loops.
This will surely be tricky, though, if only because the functions
called by the byte code operations could change these objects.
There are also two extra function calls inside the variable setting
operation (Bvarset), which is used inside the loop in the example.
They're a work around to modify struct bit fields, which can probably
be done quicker in place.
The original figures:
> (silly-loop 100000000)
> => ("Sat Feb 28 10:04:39 2004" "Sat Feb 28 10:05:30 2004") ; 51 secs
>
> (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
next prev parent reply other threads:[~2004-03-30 22:18 UTC|newest]
Thread overview: 186+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-10 16:25 Compilation to native Matthew Mundell
2004-03-20 21:52 ` Matthew Mundell
2004-03-21 19:21 ` Richard Stallman
2004-03-22 16:54 ` Juri Linkov
2004-03-22 21:37 ` Stefan Monnier
2004-03-23 13:56 ` Juri Linkov
2004-03-24 23:50 ` Matthew Mundell
2004-03-24 23:57 ` Miles Bader
2004-03-22 23:44 ` Matthew Mundell
2004-03-23 13:57 ` Juri Linkov
2004-03-24 23:51 ` Matthew Mundell
2004-03-23 17:47 ` Richard Stallman
2004-04-07 11:57 ` Kenichi Handa
2004-04-07 12:45 ` David Kastrup
2004-04-07 13:12 ` Kenichi Handa
2004-04-07 23:52 ` Alex Schroeder
2004-04-08 0:28 ` Kenichi Handa
2004-04-08 2:35 ` It is time for a feature freeze (it is NOW or never) Kim F. Storm
2004-04-08 2:03 ` Kenichi Handa
2004-04-08 3:13 ` John Wiegley
2004-04-08 4:25 ` YAMAMOTO Mitsuharu
2004-04-08 5:58 ` John Wiegley
2004-04-08 11:26 ` Piet van Oostrum
2004-04-08 8:46 ` Jason Rumney
2004-04-08 15:46 ` Kim F. Storm
2004-04-08 15:44 ` Kim F. Storm
2004-04-08 15:06 ` David Kastrup
2004-04-08 16:22 ` Stefan Monnier
2004-04-09 1:36 ` Miles Bader
2004-04-09 23:43 ` Kim F. Storm
2004-04-09 23:58 ` Miles Bader
2004-04-10 0:08 ` Miles Bader
2004-04-10 18:31 ` Kim F. Storm
2004-04-10 17:53 ` Romain Francoise
2004-04-10 22:06 ` Kim F. Storm
2004-04-11 3:08 ` Kenichi Handa
2004-04-11 11:04 ` David Kastrup
2004-04-12 7:48 ` Lőrentey Károly
2004-04-11 2:34 ` Richard Stallman
2004-04-11 9:06 ` Miles Bader
2004-04-12 4:24 ` Miles Bader
2004-04-12 21:10 ` Kim F. Storm
2004-04-12 20:48 ` Miles Bader
2004-04-13 17:44 ` Richard Stallman
2004-04-10 23:19 ` Juri Linkov
2004-04-08 2:05 ` Miles Bader
2004-04-08 2:34 ` Kenichi Handa
2004-04-08 3:39 ` Miles Bader
2004-04-08 16:30 ` Redisplay crash Stefan Monnier
2004-04-09 1:57 ` Kenichi Handa
2004-04-13 10:00 ` Piet van Oostrum
2004-04-18 21:47 ` Richard Stallman
2004-04-09 22:44 ` Richard Stallman
2004-04-10 18:36 ` Kim F. Storm
2004-04-12 3:52 ` Richard Stallman
2004-04-08 7:53 ` It is time for a feature freeze (it is NOW or never) Romain Francoise
2004-04-08 16:00 ` Kim F. Storm
2004-04-08 15:54 ` Romain Francoise
2004-04-09 22:44 ` Richard Stallman
2004-04-10 1:37 ` Kim F. Storm
2004-04-10 1:09 ` Kenichi Handa
2004-04-12 3:51 ` Richard Stallman
2004-04-14 14:57 ` Kim F. Storm
2004-04-20 21:30 ` Stefan Monnier
2004-05-01 20:16 ` Kim F. Storm
2004-05-01 23:21 ` Miles Bader
2004-05-01 21:49 ` Kim F. Storm
2004-05-02 7:30 ` David Kastrup
2004-05-02 16:06 ` Stefan Monnier
2004-05-02 18:12 ` Nick Roberts
2004-05-02 18:43 ` David Kastrup
2004-05-02 20:14 ` Nick Roberts
2004-05-03 10:29 ` Jason Rumney
2004-05-03 14:03 ` Richard Stallman
2004-05-03 19:06 ` Jan D.
2004-05-08 1:21 ` Richard Stallman
2004-05-08 11:14 ` Jan D.
2004-05-08 11:35 ` David Kastrup
2004-05-09 10:38 ` Richard Stallman
2004-05-12 10:00 ` B&W icons (was It is time for a feature freeze (it is NOW or never).) Jan D.
2004-05-02 19:16 ` It is time for a feature freeze (it is NOW or never) Stefan Monnier
2004-05-02 22:26 ` Juanma Barranquero
2004-05-03 5:44 ` Kim F. Storm
2004-05-03 9:13 ` Juanma Barranquero
2004-05-03 8:52 ` Kim F. Storm
2004-05-03 13:21 ` Stefan Monnier
2004-05-03 22:20 ` Richard Stallman
2004-05-13 17:14 ` Stefan Monnier
2004-05-13 21:50 ` Kim F. Storm
2004-05-13 22:48 ` Stefan Monnier
2004-05-14 12:18 ` YAMAMOTO Mitsuharu
2004-05-14 12:49 ` Kenichi Handa
2004-05-03 21:00 ` Kim F. Storm
2004-05-04 7:14 ` David Kastrup
2004-05-04 8:09 ` Juanma Barranquero
2004-05-04 8:17 ` David Kastrup
2004-05-04 6:34 ` Kim F. Storm
2004-05-04 8:52 ` Juanma Barranquero
2004-05-04 13:45 ` Stefan Monnier
2004-05-04 13:58 ` Juanma Barranquero
2004-05-04 8:26 ` Juanma Barranquero
2004-05-04 13:44 ` Stefan Monnier
2004-05-04 14:26 ` Juanma Barranquero
2004-05-04 14:37 ` David Kastrup
2004-05-04 20:07 ` Richard Stallman
2004-05-04 22:21 ` David Kastrup
2004-05-04 21:18 ` Kim F. Storm
2004-05-04 23:49 ` David Kastrup
2004-05-05 0:23 ` Luc Teirlinck
2004-05-05 9:24 ` David Kastrup
2004-05-04 22:24 ` Miles Bader
2004-05-05 1:04 ` Robert J. Chassell
2004-04-12 3:50 ` Richard Stallman
2004-04-12 4:15 ` Miles Bader
2004-04-13 17:44 ` Richard Stallman
2004-04-16 13:15 ` Kenichi Handa
2004-04-16 14:38 ` Stefan Monnier
2004-04-17 1:41 ` Kenichi Handa
2004-04-17 17:10 ` Stefan Monnier
2004-04-19 4:40 ` Kenichi Handa
2004-04-19 13:54 ` Stefan Monnier
2004-04-19 23:44 ` Kenichi Handa
2004-04-19 23:59 ` Miles Bader
2004-04-20 0:38 ` Kenichi Handa
2004-04-12 4:33 ` Stefan Monnier
2004-04-12 21:20 ` Kim F. Storm
2004-04-13 1:30 ` Kenichi Handa
2004-04-13 10:37 ` Kim F. Storm
[not found] ` <lorentey.g.e.devel.87brlx1wku.elte@eris.elte.hu>
2004-04-14 10:59 ` Kim F. Storm
2004-04-14 22:53 ` Richard Stallman
2004-04-15 1:19 ` Kim F. Storm
2004-04-15 19:42 ` Lőrentey Károly
2004-04-16 18:08 ` Richard Stallman
2004-04-16 18:49 ` David Kastrup
2004-04-16 20:19 ` Display-local settings (was: It is time for a feature freeze) Stefan Monnier
2004-04-16 20:38 ` David Kastrup
2004-04-16 21:09 ` Stefan Monnier
2004-04-19 15:10 ` Display-local settings Lőrentey Károly
2004-04-19 17:49 ` Stefan Monnier
2004-04-20 4:48 ` Lőrentey Károly
2004-04-17 19:46 ` It is time for a feature freeze (it is NOW or never) Richard Stallman
2004-04-19 15:49 ` Display-local variables (Re: It is time for a feature freeze) Lőrentey Károly
2004-04-19 22:09 ` Kim F. Storm
2004-04-20 4:27 ` Lőrentey Károly
2004-04-20 10:18 ` Kim F. Storm
2004-04-15 18:18 ` It is time for a feature freeze (it is NOW or never) Lőrentey Károly
2004-04-08 1:08 ` Compilation to native Richard Stallman
2004-04-08 1:31 ` Kenichi Handa
2004-04-09 22:43 ` Richard Stallman
2004-04-08 1:08 ` Richard Stallman
2004-04-13 23:12 ` Juri Linkov
2004-04-13 23:40 ` Kenichi Handa
2004-04-14 1:17 ` Juri Linkov
2004-04-14 1:54 ` Kenichi Handa
2004-04-15 11:11 ` Pure strings (Re: Compilation to native) Juri Linkov
2004-04-18 21:47 ` Richard Stallman
2004-04-19 6:36 ` Kenichi Handa
2004-04-19 14:20 ` Stefan Monnier
2004-04-19 23:39 ` Kenichi Handa
2004-04-19 18:20 ` Richard Stallman
2004-04-20 1:00 ` Kenichi Handa
2004-03-22 23:42 ` Compilation to native Matthew Mundell
2004-03-23 17:48 ` Richard Stallman
2004-03-23 22:43 ` David Kastrup
2004-03-24 23:52 ` Matthew Mundell
2004-03-30 22:18 ` Matthew Mundell [this message]
2004-03-30 22:30 ` David Kastrup
2004-03-31 18:58 ` Matthew Mundell
2004-03-30 23:31 ` Juri Linkov
2004-04-01 4:42 ` Richard Stallman
2004-04-01 4:42 ` Richard Stallman
2004-04-02 16:38 ` Matthew Mundell
2004-04-12 20:20 ` Matthew Mundell
2004-04-12 20:57 ` Stefan Monnier
2004-04-13 16:56 ` Matthew Mundell
2004-04-13 17:32 ` Stefan Monnier
2004-04-13 19:03 ` Matthew Mundell
2004-04-13 21:00 ` Miles Bader
2004-04-13 21:50 ` Miles Bader
2004-04-14 22:49 ` Matthew Mundell
2004-04-16 14:22 ` Matthew Mundell
2004-04-13 20:51 ` Miles Bader
2004-04-16 14:21 ` Matthew Mundell
2004-04-16 14:44 ` Stefan Monnier
2004-04-16 15:06 ` Matthew Mundell
2004-04-16 14:20 ` Matthew Mundell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k712gesk.fsf@sno.mundell.ukfsn.org \
--to=matt@mundell.ukfsn.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).