From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#42147: Hash-consing bignums (was: bug#42147: 28.0.50; pure vs side-effect-free, missing optimizations?) Date: Fri, 03 Jul 2020 09:39:10 -0400 Message-ID: References: <3A9CC2A3-8307-47B2-8D80-795C0AF020E1@acm.org> <0433A879-C98D-4B1A-B85C-A15DA9289099@acm.org> <1621669100.2102667.1593639091621@mail.yahoo.com> <775819003.2516724.1593687594435@mail.yahoo.com> <5F2B4684-34D1-4474-8909-9F435369FE54@acm.org> <705260433.2731607.1593698199171@mail.yahoo.com> <6CF8EE58-9A49-40E7-AA86-48AB39BF94BA@acm.org> <28B19D86-343C-4126-B95F-1F38735F73F2@acm.org> <43ce844e-b239-0c39-ad4f-86fec376f945@cs.ucla.edu> <2CEB4A36-3DDF-4868-B8E0-B6AC35C1DFAF@acm.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15722"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Paul Eggert , Andrea Corallo , 42147@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 03 15:40:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jrLvH-0003zd-K2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Jul 2020 15:40:11 +0200 Original-Received: from localhost ([::1]:37718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jrLvG-0002YT-J5 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Jul 2020 09:40:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrLv8-0002Wh-Ap for bug-gnu-emacs@gnu.org; Fri, 03 Jul 2020 09:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45099) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jrLv8-0004vQ-0f for bug-gnu-emacs@gnu.org; Fri, 03 Jul 2020 09:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jrLv7-00068W-UO for bug-gnu-emacs@gnu.org; Fri, 03 Jul 2020 09:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Jul 2020 13:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42147 X-GNU-PR-Package: emacs Original-Received: via spool by 42147-submit@debbugs.gnu.org id=B42147.159378357723549 (code B ref 42147); Fri, 03 Jul 2020 13:40:01 +0000 Original-Received: (at 42147) by debbugs.gnu.org; 3 Jul 2020 13:39:37 +0000 Original-Received: from localhost ([127.0.0.1]:56645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jrLuj-00067l-3z for submit@debbugs.gnu.org; Fri, 03 Jul 2020 09:39:37 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:23570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jrLub-00067O-HU for 42147@debbugs.gnu.org; Fri, 03 Jul 2020 09:39:36 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id AE018440F60; Fri, 3 Jul 2020 09:39:23 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C435E440F5E; Fri, 3 Jul 2020 09:39:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1593783557; bh=LL3QeBM9SDOjvTT11fgRJj0SyHDUQ7leV6BLGcg9sS0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=HaEbWtxX+7nli3msrqWpO9sMZ3nNFQwFNIC2F+hJkwL2lY7B9vJMdxIJ/si0hgzoc PIwQxVJM4D47NWEdKFSGeUs4nFanG6XhBNuMhee0EUXq0aTTgTwmAjQKJjy8TN2w5K 2to80GbftU4MH8SV8W9C29w/KxR4tZBddqsodCubHNw3WoRrOZTJY8yykMxiGbz/wy UuGNdxLHqXm9leUyZHWxgtgAaqxw9Lymofix+ywRRKcgD8+1JnaefWWwM/SlIUSt26 ydhS5cIgXzmzmmjWff5GryWyBbzZvQrRjtuOh2PKHT3y0xZD3LJzYn8wmUtqOEMURA ZZBxPKfox5aUA== Original-Received: from alfajor (unknown [157.52.0.200]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 69B36120995; Fri, 3 Jul 2020 09:39:17 -0400 (EDT) In-Reply-To: <2CEB4A36-3DDF-4868-B8E0-B6AC35C1DFAF@acm.org> ("Mattias =?UTF-8?Q?Engdeg=C3=A5rd?="'s message of "Fri, 3 Jul 2020 11:32:35 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:182664 Archived-At: > Hash-consing bignums may be a good idea (I'm neutral on the idea), but there > could be a reason why it isn't very commonly seen in other runtimes; perhaps > they have more efficient GCs (generational and/or incremental), but Emacs > would benefit (a lot) from that, too. I don't think the GC performance has very much to do with it. I think it's simply that hash-consing bignums has a negative effect on the performance of bignum operations (by a constant factor which I guesstimate to be around 50%). For a general purpose language this can be significant. In my opinion for Emacs Lisp this is irrelevant (we've lived without real bignums (using slow emulations instead) for more than 30 years, so even half-speed bignums are much better than what we really need). It could become relevant if/when we replace wide-int with bignums, in which case performance of "small bignums" could be fairly important. But I'm not sure if we'll ever want to replace wide-ints with bignums (tho I do hope we will). > In any case, it's a one-way decision: once we guarantee eq to provide > numerical equality (whether by hash-consing or otherwise), there is no > way back. Yes, once you've had the taste of clean semantics it's hard to go back ;-) Stefan "in favor of redefining `eq` to `eql`"