From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/3788 Path: main.gmane.org!not-for-mail From: raeburn@cygnus.com (Ken Raeburn) Newsgroups: gmane.emacs.gnus.general Subject: Re: Byte-compiling the line specs Date: 01 Nov 1995 11:34:31 -0500 Organization: Cygnus Support, Cambridge MA Sender: raeburn@cygnus.com Message-ID: References: <199510311028.LAA06365@ssv4.dina.kvl.dk> <199510311052.CAA16806@desiree.teleport.com> <199510311413.PAA06470@ssv4.dina.kvl.dk> NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035144621 27259 80.91.224.250 (20 Oct 2002 20:10:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 20:10:21 +0000 (UTC) X-From-Line: ding-request@ifi.uio.no Wed Nov 1 09:43:39 1995 Return-Path: ding-request@ifi.uio.no Original-Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by miranova.com (8.6.11/8.6.9) with ESMTP id JAA00509 for ; Wed, 1 Nov 1995 09:43:35 -0800 Original-Received: from cygnus.com (cygnus.com [140.174.1.1]) by ifi.uio.no with ESMTP (8.6.11/ifi2.4) id for ; Wed, 1 Nov 1995 17:34:39 +0100 Original-Received: from tweedledumb.cygnus.com (tweedledumb.cygnus.com [192.80.44.1]) by cygnus.com (8.6.12/8.6.9) with SMTP id IAA21266 for ; Wed, 1 Nov 1995 08:34:35 -0800 Original-Received: from cujo.cygnus.com by tweedledumb.cygnus.com (4.1/4.7) id AA02686; Wed, 1 Nov 95 11:34:33 EST Original-Received: by cujo.cygnus.com; (5.65v3.2/1.1.8.2/20Sep95-0235PM) id AA03412; Wed, 1 Nov 1995 11:34:32 -0500 Original-To: ding@ifi.uio.no In-Reply-To: Per Abrahamsen's message of Tue, 31 Oct 1995 15:13:59 +0100 Original-Lines: 41 Xref: main.gmane.org gmane.emacs.gnus.general:3788 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:3788 From: Per Abrahamsen 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....