all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: 38708@debbugs.gnu.org
Subject: bug#38708: [PATCH] Deduplicate flonum and bignum constants in bytecode
Date: Sun, 22 Dec 2019 17:42:50 +0100	[thread overview]
Message-ID: <AC737190-464D-4611-BAB9-011813DE681C@acm.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 384 bytes --]

Minor improvement to avoid duplication of some numbers in bytecode.

No significant degradation in compilation speed observed. The savings aren't huge either: 1382 bytes in all .elc files, but the in-memory savings are probably higher, since an extra small flonum (1.0, say) only costs 4 bytes in the .elc file, but something like 16-24 bytes in memory (pointer + boxed flonum).


[-- Attachment #2: 0001-Deduplicate-non-fixnum-numeric-constants-in-byte-com.patch --]
[-- Type: application/octet-stream, Size: 1058 bytes --]

From 9c2b6e940d9fd6db189c52b92c60ed3a3fb7dfd4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Sun, 22 Dec 2019 12:09:06 +0100
Subject: [PATCH] Deduplicate non-fixnum numeric constants in byte-compilation

* lisp/emacs-lisp/bytecomp.el (byte-compile-get-constant):
Use eql for looking up constants instead of eq, allowing
for bignum and flonum deduplication.
---
 lisp/emacs-lisp/bytecomp.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 118356ec26..60dbae1d4b 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -3462,7 +3462,7 @@ byte-compile-get-constant
 	       (if (equal-including-properties (car elt) ,const)
 		   (setq result elt)))
 	     result)
-	 (assq ,const byte-compile-constants))
+	 (assoc ,const byte-compile-constants #'eql))
        (car (setq byte-compile-constants
 		  (cons (list ,const) byte-compile-constants)))))
 
-- 
2.21.0 (Apple Git-122.2)


             reply	other threads:[~2019-12-22 16:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-22 16:42 Mattias Engdegård [this message]
2019-12-27 14:24 ` bug#38708: [PATCH] Deduplicate flonum and bignum constants in bytecode Mattias Engdegård
2019-12-27 17:07 ` Pip Cet
2019-12-28 15:49   ` Mattias Engdegård
2019-12-28 16:36     ` Pip Cet
2019-12-28 18:50       ` Mattias Engdegård
2019-12-28 19:07         ` Eli Zaretskii
2019-12-29 17:29         ` Pip Cet
2019-12-29 22:30           ` Mattias Engdegård
2019-12-30 15:46             ` Eli Zaretskii

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=AC737190-464D-4611-BAB9-011813DE681C@acm.org \
    --to=mattiase@acm.org \
    --cc=38708@debbugs.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.