Gnus development mailing list
 help / color / mirror / Atom feed
From: raeburn@cygnus.com (Ken Raeburn)
Subject: Re: Byte-compiling the line specs
Date: 01 Nov 1995 11:34:31 -0500	[thread overview]
Message-ID: <tx1n3agi99k.fsf@cujo.cygnus.com> (raw)
In-Reply-To: Per Abrahamsen's message of Tue, 31 Oct 1995 15:13:59 +0100


   From: Per Abrahamsen <abraham@dina.kvl.dk>
   Date: Tue, 31 Oct 1995 15:13:59 +0100

   I get a bit more encouraging results with Emacs 19.29 and the
   following code:

   (let ((i 100000)
   ...


   Here is the timings:

			   Min     Max
   -----------------------------------------
   Empty Loop               5       6
   "99999"                  7       8
   princ                   13      14
   format                  19      20
   number-to-string        16      17

   The three first didn't generate any garbage, while the two last
   triggered a lot of garbage collections.

Did you byte-compile the loop?  If you're interested in comparing just the
formatting and insertion mechanisms, I think it's a good idea.

I tried it.  (Byte-compiled the file, read it into a buffer, moved to the
end, ran eval-current-buffer and then eval-last-sexp a couple of times, to
get three values.)  The princ test was faster than both number-to-string
and format by about a factor of 3 (though the numerous gc passes may have
been another factor contributing to getting different results from yours).
The number-to-string and format timings were closer than in your tests.

I also experimented with some elisp code for computing the character
values to insert, using % and / and adding to ?0, and using the "insert"
byte-code opcode.  That eliminated the garbage collection, but only saved
about 20% over number-to-string and format.

I think princ is probably the way to go, at least for numbers.  Numeric
fields padded to a specified width might be another matter, though....


       reply	other threads:[~1995-11-01 16:34 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 [this message]
1995-11-01 20:39       ` Felix Lee
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=tx1n3agi99k.fsf@cujo.cygnus.com \
    --to=raeburn@cygnus.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).