Gnus development mailing list
 help / color / mirror / Atom feed
From: Felix Lee <flee@teleport.com>
Subject: Re: Byte-compiling the line specs
Date: Wed, 01 Nov 1995 12:39:42 -0800	[thread overview]
Message-ID: <199511012040.MAA12719@desiree.teleport.com> (raw)
In-Reply-To: Your message of "01 Nov 1995 11:34:31 EST." <tx1n3agi99k.fsf@cujo.cygnus.com>

I couldn't figure out what I did the first time, so I started over,
taking careful notes.

ignoring garbage collection, princ is faster up to about 5 arguments.
after that, (insert (format "")) is faster.  this is mostly because
princ requires a funcall.  if a bytecode for princ were added, princ
would probably always win.

on the other hand, princ doesn't generate garbage, so it's probably an
amortized win for up to I-don't-know-how-many arguments.

on the other other hand, realistic formats are somewhat complicated.
throw in something like "%5d", then the funcall costs increase.

(side note.  it looks like the insertN bytecode is only a marginal win
over N inserts)

here's my timings (emacs 19.29, i586-unknown-linux).  garbage
collection was effectively disabled for these runs.  the format is
	(code
	 iterations
	 (65536*sec sec msec))

;; null loop
((t)
 50000
 (0 0 212964))

;; (defun call-nil ())
(((call-nil))
 50000
 (0 0 819474))

;; (defun call-identity (x) x)
(((call-identity n))
 50000
 (0 1 19664))



;; basic insert
(((insert "99999"))
 50000
 (0 0 550920))

(((insert "a" "b"))
 50000
 (0 0 743891))

(((insert a b))
 50000
 (0 0 777184))

(((insert "a") (insert "b"))
 50000
 (0 0 766438))


;; insertN v. N inserts
(((insert "a" "b" "c" "d" "e" "f" "g" "h"))
 50000
 (0 1 882816))

(((insert "a") (insert "b") (insert "c") (insert "d")
  (insert "e") (insert "f") (insert "g") (insert "h"))
 50000
 (0 2 128370))


;; princ
(((princ 99999))
 50000
 (0 5 641750))

;; calling a function that calls princ.
(((call-princ 99999))
 50000
 (0 7 402069))

(((insert
   (number-to-string 99999)))
 50000
 (0 6 807297))


;; princ v. format comparisons.

(((princ 99999) (insert "a"))
 50000
 (0 6 484584))

(((format "%d%s" 99999 "a"))
 50000
 (0 7 557146))

(((insert (format "%d%s" 99999 "a")))
 50000
 (0 8 985531))


(((princ 99999) (insert "a") (princ 99999) (insert "b"))
 50000
 (0 12 156523))

(((format "%d%s%d%s" 99999 "a" 99999 "b"))
 50000
 (0 12 377714))

(((insert (format "%d%s%d%s" 99999 "a" 99999 "b")))
 50000
 (0 13 873505))


(((format "%d%s%d%s%d%s" 99999 "a" 99999 "b" 99999 "c"))
 5000
 (0 1 534841))

(((insert (format "%d%s%d%s%d%s" 99999 "a" 99999 "b" 99999 "c")))
 5000
 (0 1 669104))

(((princ 99999) (insert "a")
  (princ 99999) (insert "b")
  (princ 99999) (insert "c"))
 5000
 (0 1 792144))


  reply	other threads:[~1995-11-01 20:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <199510311028.LAA06365@ssv4.dina.kvl.dk>
     [not found] ` <199510311052.CAA16806@desiree.teleport.com>
     [not found]   ` <199510311413.PAA06470@ssv4.dina.kvl.dk>
1995-11-01 16:34     ` Ken Raeburn
1995-11-01 20:39       ` Felix Lee [this message]
1995-11-02 21:38         ` Ken Raeburn
1995-11-03  1:26           ` Felix Lee
1995-11-06 13:32             ` Lars Magne Ingebrigtsen

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=199511012040.MAA12719@desiree.teleport.com \
    --to=flee@teleport.com \
    /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.
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 NNTP newsgroup(s).