all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#38708: [PATCH] Deduplicate flonum and bignum constants in bytecode
@ 2019-12-22 16:42 Mattias Engdegård
  2019-12-27 14:24 ` Mattias Engdegård
  2019-12-27 17:07 ` Pip Cet
  0 siblings, 2 replies; 10+ messages in thread
From: Mattias Engdegård @ 2019-12-22 16:42 UTC (permalink / raw)
  To: 38708

[-- 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)


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-12-30 15:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-22 16:42 bug#38708: [PATCH] Deduplicate flonum and bignum constants in bytecode Mattias Engdegård
2019-12-27 14:24 ` 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

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.