From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sergey Vinokurov Newsgroups: gmane.emacs.bugs Subject: bug#53242: [PATCH] unify reads from local_var_alist Date: Fri, 14 Jan 2022 18:37:45 +0000 Message-ID: <74db84b1-5433-dfb8-8ee3-9d86d8fc9be7@gmail.com> References: <50d65dbc-f3d6-86fb-6a7c-9200a6525ec2@gmail.com> <83zgny20z2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7083"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Cc: 53242@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 14 19:39:54 2022 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 1n8RUP-0001cS-Bs for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Jan 2022 19:39:53 +0100 Original-Received: from localhost ([::1]:52182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n8RUN-0005k6-Qi for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Jan 2022 13:39:51 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n8RSc-0005ju-PX for bug-gnu-emacs@gnu.org; Fri, 14 Jan 2022 13:38:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45220) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n8RSc-0004tU-FG for bug-gnu-emacs@gnu.org; Fri, 14 Jan 2022 13:38:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n8RSc-0001CB-EP for bug-gnu-emacs@gnu.org; Fri, 14 Jan 2022 13:38:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sergey Vinokurov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jan 2022 18:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53242 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 53242-submit@debbugs.gnu.org id=B53242.16421854774582 (code B ref 53242); Fri, 14 Jan 2022 18:38:02 +0000 Original-Received: (at 53242) by debbugs.gnu.org; 14 Jan 2022 18:37:57 +0000 Original-Received: from localhost ([127.0.0.1]:38123 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8RSX-0001Bp-7l for submit@debbugs.gnu.org; Fri, 14 Jan 2022 13:37:57 -0500 Original-Received: from mail-wm1-f53.google.com ([209.85.128.53]:53919) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n8RST-0001BZ-6J for 53242@debbugs.gnu.org; Fri, 14 Jan 2022 13:37:55 -0500 Original-Received: by mail-wm1-f53.google.com with SMTP id l4so7681684wmq.3 for <53242@debbugs.gnu.org>; Fri, 14 Jan 2022 10:37:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=Q74F7xBkBghQEVkFNS2AEGaBQNJYQAEByMFzIyRl4+4=; b=JktLOMOflytVy4hEonU7A/zDzqqhciRIuAWC+aK6I0d42XJ9vxAIw+rvXCANA+wpLo rbUFocB7zYyGb1orRzjnEKc7KW4tPRn6IfA/gSGcnytHtxFLHrR+bxZOY74SLj29p+jr 9qEH/0M9jhw1OP8hdthMCjjmJvdJfxXEwuE3KMt5l3WzIBl/iM9yH7T7ZJJQrucaYnx9 1/RzYk/+m/o7yW/7QUJXlpVtwSQ4ZtyDoU1qxEOb3wpKm56spW13frJCy+JLeLwrtcFY LsVffiLCxwzNAxNEK4UG0SvymXDIevI1PfsJKtnh+3r8SEJxkIAPmVxb6oZ3Ldabs43p JIgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Q74F7xBkBghQEVkFNS2AEGaBQNJYQAEByMFzIyRl4+4=; b=7omUgKdEO+ZRQYmIib7yeWwSEKke4p7/QehFDOMPEhLGAE93/+xtgJ4ExWZd17/Pun 2Zk8kujGCBJJsnV8BD8Gv8LaZ51gYdGfZLUyCoSI/FXSxmAGRNwxTxfDdsFpUGCJjcPt 0tW7SvwoHv0sh23psPs3nd5KnDqNwLpTrmwGYV60lC4zXQanV0S0/SdFtRMka1tiyUMm hXDjvvvNMMy4ch//7PU+ihJsRd9xjxXqSUSCI4vOSlxt+z61OQ4795ZIRk09bU6a2HOG CUiz8a+DIPh/iZZRv9UWnibxAb2iWwXLY5hG/wsu1+XKisogXnmGrk7dJkvp8QCsmBT0 ZV0Q== X-Gm-Message-State: AOAM531a1JunQsScFq+8720fdW6c+OnXQAaEG5v5AVRzgdzHRk58ZDLs 027y5oA5lQnv7BidBKQiQn8= X-Google-Smtp-Source: ABdhPJxps6qUWx/ZZY/W8ZkWyXlotkFyqrynACXc9W0TWYI5pbbWmy5sKD1Yhn3JeL9LTEJ6CgrxfQ== X-Received: by 2002:a5d:634e:: with SMTP id b14mr9698859wrw.105.1642185467180; Fri, 14 Jan 2022 10:37:47 -0800 (PST) Original-Received: from [192.168.1.106] ([152.37.93.248]) by smtp.gmail.com with ESMTPSA id g6sm6383163wri.80.2022.01.14.10.37.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Jan 2022 10:37:46 -0800 (PST) Content-Language: en-GB In-Reply-To: <83zgny20z2.fsf@gnu.org> 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:224229 Archived-At: On 14/01/2022 08:08, Eli Zaretskii wrote: >> Date: Fri, 14 Jan 2022 00:23:42 +0000 >> From: Sergey Vinokurov >> >> I've noticed that local_var_alist field of the buffer structure is >> accessed inconsistently. Sometimes it's Fassoc, sometimes it's Fassq and >> other times it's assq_no_quit and even an explicit loop. >> >> I think it's safe to unify all the accesses via assq_no_quit since it's >> an internaly maintained alist that definitely has no cycles and elements >> are cons cells with symbol as their car. > > How long can local_var_alist be? This change will not allow the user > to C-g from a long search. Do we care? How about using Fassq > consistently instead? This list is not directly observed by the user. The lookups happen during reads and writes of the buffer-local variables so if it's really slow the only effect user would observe is that elisp got slow. There's no single point for the user to C-g from. This list definitely cannot be longer than a list of all the global variables ever defined. This upper bound is probably a high number, but not astronomically high. Perhaps if list gets really long it could be beneficial to use some other data structure, perhaps a hash table, instead.