From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: Emacs design and architecture Date: Mon, 18 Sep 2023 08:36:50 +0200 Message-ID: References: <87fs3ur9u8.fsf@dataswamp.org> <875y4moiiq.fsf@dataswamp.org> <83r0n4rj78.fsf@gnu.org> <83cyynpmvd.fsf@gnu.org> <838r99mh40.fsf@gnu.org> <83h6nwlmt4.fsf@gnu.org> <456d12ac-ecf4-3de4-56bb-a2440580777f@gutov.dev> <83a5tokmsv.fsf@gnu.org> <83sf7fki5g.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24542"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Yuri Khan , dmitry@gutov.dev, owinebar@gmail.com, rms@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 18 08:37:47 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 1qi7tD-0006CS-1r for ged-emacs-devel@m.gmane-mx.org; Mon, 18 Sep 2023 08:37:47 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qi7sT-0003Ro-RH; Mon, 18 Sep 2023 02:37:02 -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 1qi7sS-0003QO-1m for emacs-devel@gnu.org; Mon, 18 Sep 2023 02:37:00 -0400 Original-Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qi7sQ-0000CF-5C; Mon, 18 Sep 2023 02:36:59 -0400 Original-Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-99bdcade7fbso518568466b.1; Sun, 17 Sep 2023 23:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695019012; x=1695623812; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CjRic2NaHOXwtgjgMW2ClzgXHopXUJd1YEs4lSwMKRA=; b=CmKvu2XPegsyhXIl6O/EY0zd6Xnoar/PqkHKXf5gkJnY9VcwAdp7t0U+fujn7JNFRq Vy6UNe80jyOjPMpaYnSry7MHI5HEfXYqUPInf5gbqTia5KAsIW1rwrnKd9y59WOgZElj 8aD+QIJAmm/49kcL3AohQcRx7VkpJn1ytZBLCwCc16v/meJQEWuCNB2KjJfTWql28GNb bzrJJWWjd756Hia6bX4MGmRm48WvEDIczETyzvr9/y3hxPVj/7IoGUXXRzbNJOeSqpom Z30Sb7pzM5azClBPy9HoQZfPacDWyiK9EGtwIjCYaXNogshlsYyWvh/zN94l6rZn/ctv 4vdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695019012; x=1695623812; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=CjRic2NaHOXwtgjgMW2ClzgXHopXUJd1YEs4lSwMKRA=; b=p7Y3k5z/VQHb2P4Ogd5pOCZrQqR12pfJEHNqqBnm7/BeNEcp2mDSJc6dGvNXLH84bi dnBsclIC4akbnQL7X6q9PpdAiXw0XHK3S24bF/N76vF+Llut00C1MAWqufUC0O45YJLI QOSHFG8zycQyd80q0Moxr6FZ6CPdGTs903+XLPBILKQL/iL1h+5oBo55r6KnUxPfPXoD 3SC/RSGX80WWISZvmyuTIfcacG48pABbX1pKQawjU5slPBdrX7DrYAiFM/BkLCjoyKcE b30ovoBP+dUSBEukD2F8ygJdfrPQaUtQW1aVO9xdcW5yox1BKjneVMdBJe8qGG4U2K7H JdFg== X-Gm-Message-State: AOJu0YzvvVdVytNuuaa1pWH/SFUpK5ku/ziL2snLnKXsWQI/ZmK142xL 7HZxGKXTAMlnftNNBbpXrhB/xnvEfEhRZSX7 X-Google-Smtp-Source: AGHT+IGbBU+DfxfNKzO9XrwnK2QY7PbZjuaXVtlkJW34vSnXK4uCn9+0rGExOIwxQ5pcZcmxUidL3Q== X-Received: by 2002:a17:906:8a4b:b0:9a5:d657:47e5 with SMTP id gx11-20020a1709068a4b00b009a5d65747e5mr7096358ejc.49.1695019011894; Sun, 17 Sep 2023 23:36:51 -0700 (PDT) Original-Received: from Pro.fritz.box (p4fe3af17.dip0.t-ipconnect.de. [79.227.175.23]) by smtp.gmail.com with ESMTPSA id rn5-20020a170906d92500b0099bd5d28dc4sm5956487ejb.195.2023.09.17.23.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 23:36:51 -0700 (PDT) In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llmann?= =?utf-8?Q?=22's?= message of "Sun, 17 Sep 2023 09:34:27 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URI_DOTEDU=1 autolearn=no 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:310685 Archived-At: Gerd M=C3=B6llmann writes: > Gerd M=C3=B6llmann writes: > >> Gerd M=C3=B6llmann writes: >> >>> This of course, would pose several problems. >>> >>> - This form of parallel redisplay cannot call Lisp, so no jit-lock, no >>> hooks, or whatever during redisplay. And at the point where we call >>> redisplay today we don't know what will be displayed... >>> - Parallel redisplay also needs either a copy of what it to be >>> displayed, or the model must be some persistent data structure >>> that makes immutable versions of buffer-text, for instance, >>> available. >> >> Some more idle musings: >> >> Let's say persistent data structures for buffer-text, overlays, text >> properties and maybe other things are out of question because of the >> effort involved. >> >> Another idea would be to produce, where we currently run redisplay, a >> "model" that can be processed concurrently. One could just guess how >> much text will be displayed, run Lisp code as necessary (jit-lock), skip >> invisble text, and so on, so that the parallel redisplay doesn't have >> the need to call Lisp. For simplicity, think of that new form of model >> as HTML. >> >> That could be so slow that parallelism is not a win. >> >> What about the move_.* functions used by Lisp (vertical-motion, ...)? >> To what degree does backward compatibily restrict what can be done in >> the first place? I'm beginning to think it sets quite harsh limits. >> >> Doesn't look good to me :-(. > > Here are some things I found wrt to buffer-text implementation. > > A ninteresting paper about text representations in general: > https://www.cs.unm.edu/~crowley/papers/sds.pdf > > Piece tables: > https://www.averylaird.com/programming/the%20text%20editor/2017/09/30/the= -piece-table > > An implementation: > https://github.com/cdacamar/fredbuf > > Something like that could be an inspiration for a persisten buffer-text > implementation, which I think would be a prerequisite for a parallel > redisplay. (I don't believe in the idea of a snapshort model for parallel > redisplay =07anymore). This would not solve overlays, text properties > and what not, of course. And a bit more: This is an interesting article about VSCode's buffer implementation, which was changed from a line-based representation to a piece tree (don't know if persistent or not): https://code.visualstudio.com/blogs/2018/03/23/text-buffer-reimplementation In summary, I think that, for a parallel redisplay in Emacs, a persistent piece tree would probably a good choice, and it is doable. From a performance aspect, the Monaco editor (see link above) seems to show that it's not too bad. Overlays, text properties, calls to Lisp etc. remain open aspects.