From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Excessive use of `eassert` Date: Sat, 20 Jan 2024 17:41:57 -0800 Organization: UCLA Computer Science Department Message-ID: <811d5f03-fad4-47e1-b3fd-2f45229a5ee1@cs.ucla.edu> References: <83jzo5x0q8.fsf@gnu.org> <83sf2tv029.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------lZkIkVOwyymLLbNCCxecBcnx" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10404"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Stefan Monnier , emacs-devel@gnu.org To: Alan Mackenzie , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 21 02:42:57 2024 Return-path: Envelope-to: ged-emacs-devel@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 1rRMrR-0002WC-4p for ged-emacs-devel@m.gmane-mx.org; Sun, 21 Jan 2024 02:42:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRMqd-000509-4J; Sat, 20 Jan 2024 20:42:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rRMqa-0004ma-E4 for emacs-devel@gnu.org; Sat, 20 Jan 2024 20:42:04 -0500 Original-Received: from mail.cs.ucla.edu ([131.179.128.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rRMqX-0003F5-Ci; Sat, 20 Jan 2024 20:42:03 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 389803C005171; Sat, 20 Jan 2024 17:41:58 -0800 (PST) Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id tL-1gm4tMTv8; Sat, 20 Jan 2024 17:41:57 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 89BC23C005172; Sat, 20 Jan 2024 17:41:57 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 89BC23C005172 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1705801317; bh=FcX5UtJHALBuXKiBJSYcGBVZipJZlnCs+c+D4iRSi0U=; h=Message-ID:Date:MIME-Version:To:From; b=fnK+bfWq0brCX75OihXAgGEo1j6z7/NVxA0c/EuTmHeE9GdF+FEecBiy5A+lg+JnX TY7PYSRc4G21HJb7+PjHPOMGmqB6Z6+UVWOSdVtWxeHbWNArIDEJaTMh3om6GDPKit yvjZWDH4AWtd5liPtzJk8VEkleAcKu/O9/ViR/V6TsSNXKngscSM3NjZOw/mgGzn4G UZcKhb7GQhuC5DgwO6GdrObr3uXJ6rEj45ikzPK5UF2qScYaRn0zG1Sf1OI18vzx7J wva23w/ePFKXqmQ8t7KPS9cT+2qz1h9nxH3FM4/KWdog8bCigpbU8+4fMlvWCu6zcX hReEUq3v2WQIQ== X-Virus-Scanned: amavis at mail.cs.ucla.edu Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id IAlIJJN-XqAr; Sat, 20 Jan 2024 17:41:57 -0800 (PST) Original-Received: from [192.168.254.12] (unknown [47.148.192.211]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 586373C005171; Sat, 20 Jan 2024 17:41:57 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=131.179.128.66; envelope-from=eggert@cs.ucla.edu; helo=mail.cs.ucla.edu X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:315159 Archived-At: This is a multi-part message in MIME format. --------------lZkIkVOwyymLLbNCCxecBcnx Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-01-19 11:42, Alan Mackenzie wrote: > On Fri, Jan 19, 2024 at 17:02:06 +0200, Eli Zaretskii wrote: >> make_fixnum is a trivial bit-shuffling, whereas make_lisp_symbol is >> much trickier. Perhaps especially so now that we have >> symbols-with-positions as well as bare symbols. > > Not really. Symbols with positions don't belong in the obarray. If they > somehow get there, then that's a bug to be fixed. The problem here isn't calling make_lisp_symbol to make symbols with positions. It's that Qnil expands to builtin_lisp_symbol (0) which calls make_lisp_symbol (&lispsym[0]) which calls XSYMBOL, and XSYMBOL is significantly slower now that we have symbols-with-positions, even when it is applied to a bare symbol - and this is particularly true with --enable-checking and the eassert Stefan mentioned. I looked into this a bit and installed the attached patches which should speed things slightly even with a default build. The main goal was to speed up debugging builds, though. When I built with --enable-checking this seemed to help significantly on Ubuntu 23.10 x86-64 with GCC 13.2 -O2 (at least looking at the machine code; I didn't benchmark). This depends on compiler and platform so it'd be helpful if Stefan could try it out on his machine and see whether it helps his cases' performance. --------------lZkIkVOwyymLLbNCCxecBcnx Content-Type: text/x-patch; charset=UTF-8; name="0001-Simplify-and-tune-XSYMBOL.patch" Content-Disposition: attachment; filename="0001-Simplify-and-tune-XSYMBOL.patch" Content-Transfer-Encoding: base64 RnJvbSBjZjI2ZjU3MzE2MjEzMGZlZDczYzZlNTYwM2NiNThlMTU4OTAzYWRkIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBTYXQsIDIwIEphbiAyMDI0IDE2OjUyOjMxIC0wODAwClN1YmplY3Q6IFtQQVRD SCAxLzJdIFNpbXBsaWZ5IGFuZCB0dW5lIFhTWU1CT0wKTUlNRS1WZXJzaW9uOiAxLjAKQ29u dGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PVVURi04CkNvbnRlbnQtVHJhbnNmZXIt RW5jb2Rpbmc6IDhiaXQKCiogc3JjL2xpc3AuaCAoWFNZTUJPTCk6IFNpbXBsaWZ5IGFuZCB0 dW5lLiAgVGhlcmUgaXMgbm8gbmVlZCB0bwpleGFtaW5lIHN5bWJvbHNfd2l0aF9wb3NfZW5h YmxlZCBoZXJlLCBzaW5jZSB0aGUgYXJnIG11c3QgYmUgYSBzeW1ib2wKc28gaWYgaXQncyBu b3QgYSBiYXJlIHN5bWJvbCB0aGVuIGl0IG11c3QgYmUgYSBzeW1ib2xfd2l0aF9wb3M7CmFu ZCBjaGVja2luZyB3aGV0aGVyIGEgc3ltYm9sIGlzIGJhcmUgaXMgY2hlYXAuCgpXaXRoIFVi dW50dSAyMy4xMCBvbiBhIFhlb24gVy0xMzUwLCB0aGlzIHNocmFuayBFbWFjc+KAmXMgZXhl Y3V0YWJsZQ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type: text/x-patch; charset=UTF-8; name="0002-Speed-up-make_lisp_symbol-when-debugging.patch" Content-Disposition: attachment; filename="0002-Speed-up-make_lisp_symbol-when-debugging.patch" Content-Transfer-Encoding: base64 RnJvbSBiZGNkNjYyYTIxZjRjNDI2NWY3MDRiNjlkZWI5Y2YyNzdhNjYzZWE3IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBTYXQsIDIwIEphbiAyMDI0IDE2OjUyOjMxIC0wODAwClN1YmplY3Q6IFtQQVRD SCAyLzJdIFNwZWVkIHVwIG1ha2VfbGlzcF9zeW1ib2wgd2hlbiBkZWJ1Z2dpbmcKCiogc3Jj L2xpc3AuaCAobWFrZV9saXNwX3N5bWJvbCk6IEluIGVhc3NlcnQgdXNlIFhCQVJFX1NZTUJP TApyYXRoZXIgdGhhbiBYU1lNQk9MLiAgVGhpcyBpcyBzYWZlIGJlY2F1c2UgdGhlIHN5bWJv bCBtdXN0IGJlCmJhcmUuICBUaGUgY2hhbmdlIHNwZWVkcyB1cCBtYWtlX2xpc3Bfc3ltYm9s IHdoZW4gZGVidWdnaW5nLgotLS0KIHNyYy9saXNwLmggfCAyICstCiAxIGZpbGUgY2hhbmdl ZCwgMSBpbnNlcnRpb24oKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9zcmMvbGlz cC5oIGIvc3JjL2xpc3AuaAppbmRleCBjMzMwOWM4MWExNi4uZjBiZWFmYmE0MmMgMTAwNjQ0 Ci0tLSBhL3NyYy9saXNwLmgKKysrIGIvc3JjL2xpc3AuaApAQCAtMTE2Niw3ICsxMTY2LDcg QEAgbWFrZV9saXNwX3N5bWJvbCAoc3RydWN0IExpc3BfU3ltYm9sICpzeW0pCiAgICAgIGNh c3QgdG8gY2hhciAqIHJhdGhlciB0aGFuIHRvIGludHB0cl90LiAgKi8KICAgY2hhciAqc3lt b2Zmc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