From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: How to add pseudo vector types Date: Wed, 21 Jul 2021 09:02:25 -0700 Message-ID: <86sg074pv2.fsf@stephe-leake.org> References: <83h7gw6pyj.fsf@gnu.org> <45EBF16A-C953-42C7-97D1-3A2BFEF7DD01@gmail.com> <83y2a764oy.fsf@gnu.org> <83v95b60fn.fsf@gnu.org> <00DD5BFE-D14E-449A-9319-E7B725DEBFB3@gmail.com> <83r1fz5xr9.fsf@gnu.org> <1AAB1BCC-362B-4249-B785-4E0530E15C60@gmail.com> <83czri67h0.fsf@gnu.org> <46BBFF88-76C3-4818-8805-5437409BEA93@gmail.com> <83wnpq46uk.fsf@gnu.org> <533BD53B-4E85-4E9E-B46A-346A5BBAD0F5@gmail.com> <258CB68D-1CC1-42C8-BDCD-2A8A8099B783@gmail.com> <1a776770-50b7-93cd-6591-c9a5b3a56eb8@gmail.com> <86a6mh54ko.fsf@stephe-leake.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="3444"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) Cc: =?utf-8?Q?Cl=C3=A9ment?= Pit-Claudel , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 21 18:07:43 2021 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 1m6El5-0000bt-6P for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Jul 2021 18:07:43 +0200 Original-Received: from localhost ([::1]:44004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6El4-0004m7-5u for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Jul 2021 12:07:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6EgP-00069a-48 for emacs-devel@gnu.org; Wed, 21 Jul 2021 12:02:53 -0400 Original-Received: from gateway30.websitewelcome.com ([192.185.144.21]:12578) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6EgN-0003la-5X for emacs-devel@gnu.org; Wed, 21 Jul 2021 12:02:52 -0400 Original-Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway30.websitewelcome.com (Postfix) with ESMTP id B6EFCF370B for ; Wed, 21 Jul 2021 11:02:29 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id 6Eg1m9K3WUcVP6Eg1mCqna; Wed, 21 Jul 2021 11:02:29 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=mu04pYBF88mMKRWkThUVpEhgd8L4KUnewyrhydcqtGg=; b=ewY4H78MhGlI3MMlyjS5R5ON9E QWjBcUqL90XXOY6w4JVQoGUG3fZu+dyGe5xJKV2t1l8QSMPY2zbo8pbb3qIfglTTxuP48lDDQfH0w krRy9TwHM+FfzIhbfHk8YZoC9CoaxKnL3tfgUL+y2pCLzI78vbw2BRFsf3opvPJZwwyTxoZ3i9kYM DUQjkGc7iyPHx9HIQ1/e24oM2DQNOxFNCUajamYYitOHJSvrZlT2aIyM8vGcDf1TrD0kzoRG13gbA v3aGJZbCJv5xWPtnYXC1zSQH1UvGvfpl3ARfsdLUjtCrAOTXhU5bNVpfllQQCrKcKf6JqoidTQOo2 aC4T/MJg==; Original-Received: from [76.77.182.20] (port=61821 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1m6Eg1-0005Fk-1F; Wed, 21 Jul 2021 10:02:29 -0600 In-Reply-To: (Stefan Monnier's message of "Tue, 20 Jul 2021 13:36:04 -0400") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1m6Eg1-0005Fk-1F X-Source-Sender: (Takver4) [76.77.182.20]:61821 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 3 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes Received-SPF: permerror client-ip=192.185.144.21; envelope-from=stephen_leake@stephe-leake.org; helo=gateway30.websitewelcome.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.779 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:271417 Archived-At: Stefan Monnier writes: >>> If we copy the buffer's content to a freshly malloc area before passing >>> that to TS, then there should be no problem running TS in a separate >>> concurrent thread, indeed. >> Except that the results will not be useful, since they won't apply to >> the original buffer if it is changed. > > Not true: we just have to keep track of the list of changes (as Yuan's > patch does), then pass it to tree-sitter to get a tree up-to-date w.r.t > the current content of the buffer. The point is that more changes can happen while the parser is running. >> And if the original buffer is not changed, then we do not need to run >> the parser asynchronously. > > We do: > - because we want to do other things in the mean time > - because we want to take advantage of the many CPU cores sitting > idle. "using more cores" means parallel execution, which can still be synchronous. That could be done for all invocations of the parser. In the typical case of opening a new buffer, it might make sense to spawn a thread to compute the fontification while the rest of the major-mode-hook runs. Except functions on that hook could affect the fontification, and not by changing the buffer; they could set the fontification level or style. Are there "other things" that are guaranteed to not affect fontification? In any case, the buffer must be read-only while the fontification is being computed, so either the main emacs thread must wait for the fontification to complete, or it must actually mark the buffer read-only until the fontification completes, which could surprise the user. On the other hand, if we don't force read-only, it might be possible to use only part of the fontification information, up to the first change. -- -- Stephe