From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/3792 Path: main.gmane.org!not-for-mail From: Felix Lee Newsgroups: gmane.emacs.gnus.general Subject: Re: Byte-compiling the line specs Date: Wed, 01 Nov 1995 12:39:42 -0800 Message-ID: <199511012040.MAA12719@desiree.teleport.com> References: NNTP-Posting-Host: coloc-standby.netfonds.no X-Trace: main.gmane.org 1035144625 27303 80.91.224.250 (20 Oct 2002 20:10:25 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 20:10:25 +0000 (UTC) X-From-Line: ding-request@ifi.uio.no Wed Nov 1 13:41:03 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 NAA02813 for ; Wed, 1 Nov 1995 13:40:52 -0800 Original-Received: from desiree.teleport.com (desiree.teleport.com [192.108.254.21]) by ifi.uio.no with ESMTP (8.6.11/ifi2.4) id for ; Wed, 1 Nov 1995 21:41:07 +0100 Original-Received: from teleport.com (ip-pdx11-35.teleport.com [204.245.212.163]) by desiree.teleport.com (8.6.12/8.6.9) with ESMTP id MAA12719 for ; Wed, 1 Nov 1995 12:40:11 -0800 Original-To: ding@ifi.uio.no In-reply-to: Your message of "01 Nov 1995 11:34:31 EST." Original-Lines: 126 Xref: main.gmane.org gmane.emacs.gnus.general:3792 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:3792 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))