all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: rms@gnu.org
Cc: 11935@debbugs.gnu.org
Subject: bug#11935: XINT etc. should be functions
Date: Sun, 15 Jul 2012 06:41:41 -0700	[thread overview]
Message-ID: <5002C895.4080400@cs.ucla.edu> (raw)
In-Reply-To: <E1Sprxu-0007gg-5D@fencepost.gnu.org>

On 07/13/2012 07:20 PM, Richard Stallman wrote:
> How does this change affect performance with -O0?

It hurts it.  In normal operation I don't notice --
everything is plenty fast enough -- but in an artificial
benchmark designed to stress the new code (see below) the
performance is significantly worse.  If this is an issue,
we can mark these new functions with __attribute__
((__always_inline__)), but I'm inclined to try things
without this attribute, and resort to the attribute only if
needed.

I did two measures of performance.  "text" simply counts the
number of bytes in the text segment.  "bench" counts the
number of CPU seconds consumed by running the benchmark
described below.  "current" refers to trunk bzr 109093, and
"patched" to that bzr after the proposed patch is applied.
In both cases I've normalized the numbers to the current
default (so it scores as 1), and smaller numbers are better.

text   bench
1.000   1.00   current (default optimization)
0.995   0.99   patched (default optimization)
1.332   1.82   current (-O0)
1.410  11.86   patched (-O0)

My benchmark was (benchmark 100000), with the following
code, byte-compiled.  My platform is Fedora 15 x86-64,
compiled with GCC 4.7.1.  Benchmark timings are sloppy, as
usual, so I wouldn't attach much significance past the first
couple of digits.

(defvar longlist '(a b c d e f g h i j k l m n o p q r s t u v w x y z))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(setq longlist (append longlist longlist))
(defvar x)

(defun benchmark-with (n)
  (let ((start (float-time (get-internal-run-time)))
	(v (make-vector 1 0))
	(i 0))
    (while (< i n)
      (setq x (nth 8000 longlist))
      (setq i (1+ i)))
    (- (float-time (get-internal-run-time)) start)))

(defun benchmark-without (n)
  (let ((start (float-time (get-internal-run-time)))
	(v (make-vector 1 0))
	(i 0))
    (while (< i n)
      (setq i (1+ i)))
    (- (float-time (get-internal-run-time)) start)))

(defun benchmark (n)
  (- (benchmark-with n)
     (benchmark-without n)))






  reply	other threads:[~2012-07-15 13:41 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-13 15:07 bug#11935: XINT etc. should be functions Paul Eggert
2012-07-14  2:20 ` bug#11935: [TRUNCATED MESSAGE 2746 87596] " Richard Stallman
2012-07-15 13:41   ` Paul Eggert [this message]
2012-07-15 22:06     ` Stefan Monnier
2012-07-16 14:54       ` Paul Eggert
2012-07-16 16:12         ` Eli Zaretskii
2012-07-16 21:40           ` Paul Eggert
2012-07-16 18:19     ` Richard Stallman
2012-07-16 22:46       ` Paul Eggert
2012-07-17  3:04         ` Eli Zaretskii
2012-07-17  3:54           ` Paul Eggert
2012-07-24  2:20           ` Paul Eggert
2012-07-24  9:07             ` Stefan Monnier
2012-07-24 13:45               ` Paul Eggert
2012-07-24 21:57                 ` Stefan Monnier
2012-07-25  4:07                   ` Paul Eggert
2012-07-15 14:41 ` Chong Yidong
2012-07-15 16:40   ` Paul Eggert
2012-07-16  2:22     ` Chong Yidong
2012-07-16 14:54       ` Paul Eggert
2013-06-06 15:56 ` Paul Eggert
2013-06-06 16:36   ` Andreas Schwab
2013-06-13 16:30     ` Paul Eggert
2013-06-06 16:42   ` Stefan Monnier
2013-06-09  0:52     ` Paul Eggert
2013-06-09  3:04       ` Stefan Monnier
2013-06-09  4:37         ` James Cloos
2013-06-09  6:59           ` Jan Djärv
2013-06-09  7:13         ` Paul Eggert
2013-06-09 15:57           ` Stefan Monnier
2013-06-13 14:45             ` Paul Eggert
2013-06-13 20:08               ` Stefan Monnier
2013-06-15  6:43                 ` Paul Eggert
2013-06-15 14:22                   ` Stefan Monnier
2013-06-17  6:05                     ` Paul Eggert
2013-06-09  6:56       ` Jan Djärv
2013-06-09  7:23         ` Paul Eggert
2013-06-09  9:18           ` Jan Djärv
2013-06-09 14:25             ` Juanma Barranquero
2013-06-09 16:05               ` Jan Djärv
2013-06-10 13:40 ` Barry OReilly

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5002C895.4080400@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=11935@debbugs.gnu.org \
    --cc=rms@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.