From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Concurrency via isolated process/thread Date: Mon, 24 Jul 2023 20:15:58 +0800 Message-ID: <87jzup1p4x.fsf@yahoo.com> References: <871qhnr4ty.fsf@localhost> <87r0plxbep.fsf@localhost> <83ilawhpi6.fsf@gnu.org> <87zg48apwr.fsf@localhost> <83edljg8ub.fsf@gnu.org> <87o7knbxr7.fsf@localhost> <838rbrg4mg.fsf@gnu.org> <87ilavbvdr.fsf@localhost> <834jmffvhy.fsf@gnu.org> <878rbrbmwr.fsf@localhost> <83fs5zecpo.fsf@gnu.org> <87351zbi72.fsf@localhost> <83351yevde.fsf@gnu.org> <87cz12ad2w.fsf@localhost> <83a5w6cwdr.fsf@gnu.org> <87pm518m0g.fsf@localhost> <83o7kl9tyj.fsf@gnu.org> <874jmd89us.fsf@localhost> <878rb53dkj.fsf@localhost> <87wmyp1vr9.fsf@yahoo.com> <875y6939jl.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29754"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jul 24 14:17:46 2023 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 1qNuVW-0007Wz-8b for ged-emacs-devel@m.gmane-mx.org; Mon, 24 Jul 2023 14:17:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNuUH-0006Oi-GI; Mon, 24 Jul 2023 08:16:29 -0400 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 1qNuUB-0006N7-FO for emacs-devel@gnu.org; Mon, 24 Jul 2023 08:16:26 -0400 Original-Received: from sonic305-21.consmr.mail.ne1.yahoo.com ([66.163.185.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qNuU5-0005JM-Ad for emacs-devel@gnu.org; Mon, 24 Jul 2023 08:16:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1690200973; bh=KQMVICYuKvt52YimCo1bYq8lVaSukjB2cvNJ+Nqkdyo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=dZgdnm751lFicT+7spgJotyJpLLcNykIcdMeY1llMIOZpB6tLvm2+0lsAQrT57jws+9l+KQwvkjttLBRn9qL3T8s5lbizdSQK3l6YrPt722MFTOS4v8p+3QfpOisdWwGtnAgHMySp2xHDRu5V/oh7Ay+0DHy9QxeKQsdCd4JNnuf+50IN+YGbStBZd2rSBl9cBb78EXEgtE17qE2pHucmgRMw0Xqte6OwAcNzjC9ILj4IH2JFTrqKGr1x+UydxzpgMGKPYz6sL5oqivYFD9uV9SZyXL0IDkTX+2fK1J+JRVi/I9XjUkPbcI4xhyqWFTIGkBigUnRcNkr1w3hzMRNZQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1690200973; bh=UsNo9psFgNd/wckV8OWLJqlPUokYZfuxhGCQ9bEwTYa=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Ggq4w10VjDNI4qdxNPj9lmuqrxPlZwo7GtcTf4Q7X0hV0JYhM1/jVf6nhemqcXYvmjY9MQ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FNBn4f.1MlzT7fZM0A70T421JfM7XmJDDfZE1RAZkF0oDx_rx. HCJu1RQBlIxcHHpHgPteviehjTWwMQDta2M0FzImqZ X-Sonic-MF: X-Sonic-ID: 2abfefba-c079-45be-8167-2f0d50930dfa Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Mon, 24 Jul 2023 12:16:13 +0000 Original-Received: by hermes--production-sg3-9dc5f54fc-9znrz (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID a48be9c8b723318ba332165d2b1c902a; Mon, 24 Jul 2023 12:16:07 +0000 (UTC) In-Reply-To: <875y6939jl.fsf@localhost> (Ihor Radchenko's message of "Mon, 24 Jul 2023 10:09:50 +0000") X-Mailer: WebService/1.1.21647 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.185.147; envelope-from=luangruo@yahoo.com; helo=sonic305-21.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=unavailable 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:308050 Archived-At: Ihor Radchenko writes: > I do not plan to slow down access to PT. > The basic idea is to have > #define PT (current_thread->m_pt + 0) > #define PT_BYTE (current_thread->m_pt_byte + 0) > > Basically, use thread object slot instead of buffer object slot to store > point and restriction. This will not cause any performance degradation > and allow multiple points in the same buffer. No matter where thread local points are stored, each of these points will need to be a marker, because text editing operations will otherwise cause PT in other threads to be desynchronized with PT_BYTE within multibyte buffers. Both unibyte buffers and multibyte buffers will also experience complications if a thread deletes text within a buffer, reducing its size below point within another thread. Each text editing operations must then loop through and update each of these markers. > What may be slightly slower is setting/getting points in other (not > current) buffers. > We will need to store point and restriction history for each thread. > Searching this history will scale with the number of buffers that have > been current previously during thread execution (though we may use hash > table if necessary). > > However, accessing and changing point in buffer that is not current is > not very common. AFAIU, it is done in (1) read operation when reading > from stream represented by a buffer; (2) when switching buffers when we > need to transfer current PT to history for current buffer and retrieve > PT from history for the buffer that will become current. See above. What you are proposing is a fundamental change to the performance attributes of some of the most basic operations performed by Emacs, and is not acceptable. > I propose to remove buffer points completely and use thread points > instead. IMHO, any change that increases the number of objects that store points will be a mistake. There is only one buffer, but there can be many threads.