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: Gap buffer problem? Date: Thu, 12 Dec 2024 20:40:54 +0100 Message-ID: References: <8634iwex8q.fsf@gnu.org> <86wmg7bso1.fsf@gnu.org> <87cyhzmzbp.fsf@telefonica.net> <87bjximwnj.fsf@protonmail.com> <87msh2l81l.fsf@protonmail.com> <12e84107-4f21-4ee0-9963-6f04bcc8f6ac@online.de> <9d3ea25a-3dc5-40ad-9e63-6511c2076c6d@gutov.dev> <817695b4-4b10-4e63-aab8-9ab450b2d671@gutov.dev> 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="14220"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Marcus Harnisch , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 12 20:41:20 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 1tLp3o-0003WS-Df for ged-emacs-devel@m.gmane-mx.org; Thu, 12 Dec 2024 20:41:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLp3b-0003Qf-Em; Thu, 12 Dec 2024 14:41: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 1tLp3Y-0003QW-Pn for emacs-devel@gnu.org; Thu, 12 Dec 2024 14:41:04 -0500 Original-Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLp3U-0001n4-QK for emacs-devel@gnu.org; Thu, 12 Dec 2024 14:41:04 -0500 Original-Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5cec9609303so1361724a12.1 for ; Thu, 12 Dec 2024 11:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734032458; x=1734637258; 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=xu3RnPPupLHtFVKybRkQuuLAXkHnP4ocbZcGA+zDFG8=; b=fR2z88i0UtOkYBbihR4Uqs7rNDOG3IWdFEPP9EFDJ6MbVw0rZCVbZUJ+p9+wm78hJ/ tJAXQr5N64mULDJQpD7EyVXq6kHiGerp984yJIT5V6SA9tKXfWjb4P4SH2ycruIxDtzr 1yCEtvdkfl1p+jfbRP7qO42gdbfsAJTEh9FAsMGnez/umwEBX11ugSXw58Wk6tGw+sZd 2G2ElYIQa1stKjsCYiW0ZlJ9KMsIbbQcp2bSw0EXpa9wOKX6asO4rwkJqrrl/F0/6QpI yYkZXXzQBuZEqZtmj6VmJHorOG0BFjmecYZ9Xtj40MIT8Sjw7e/L4uP/uG8tcEdRWaMq FomQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734032458; x=1734637258; 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=xu3RnPPupLHtFVKybRkQuuLAXkHnP4ocbZcGA+zDFG8=; b=RmmlFP8rau6XmTSV5Ncuu8BxTAEqbaww3AS45tOB3Qq8tsBNyQPyBfc+tvPmIqlX+w tLYumbNuWlHFlkjP+LJ2INCj9ckkTEKfW7oWmPU1mbQ0hAqCzO6RAdBZRAYtjHqFw2v3 8tdOaEgtstzhU1sJ4oqotz5bJo+KWyO6cXSO2DhwZf5O3SovLuHfCBSboPcefmHCGjSh mmtycrdOqK63HR1Q3ogNOb0/ebzjB8DS2zc4ansHg8QdWWC5bKvrvkDTGIBXIeOB2uqO w89KNYHKSS2Ly2vjcpPIw93gNCYN8vJWdN2d9XJ6KbtpgQBqWwxP/S4Jvb5ys0bP34kG +0JQ== X-Forwarded-Encrypted: i=1; AJvYcCWwKRwDrpQ0C8koMyKz8L0gIHzR96xoe5RRfGXbCgT/PpsUVAatciW8sZQW2rjnQdXuWxM7H8v+HrzbxA==@gnu.org X-Gm-Message-State: AOJu0YxY7bKu6g0u1NZHnR+nhNPHUqvEj3l4xtN2v6efoCJ5kD9BNg4w mKpKyYj+9ujJhS2ZktFZfxAWQkyGneN0StL58QdszU5PmIwb5yYl3RvHBU46 X-Gm-Gg: ASbGncsTKxArb6D+EbismFC8+8pprdR0xe7LA/MvAiFmdvxa0GN+u4NxasgFZinvJli Wly1ApTC4omRlhcbS3QF/XPLBWdqbbs+y30zpsMATRYZ7u6A7EdD+/SL7/8aSEtgk2FYeN2KLJ1 b/8MhYCpH6/kDlcSY6eRi4Db9Ji9fZMTml3DB15JBGxRWBU64nALAuIJmqkFudLShxo8vY/UnLW 6u8A6YGrFVLvFN/36gfCCcFCcqIDy5b/bmjMEKzKc3+xeovkIGoTEjUfYYr99GRleYgal+s73cZ bBK6tMxLUalGbWH4B2U19QgX+CYqMqZHCs1QYBlhWB+Xq13T8xVjE9hhJqfyuewqMQ== X-Google-Smtp-Source: AGHT+IEqMuBfSqQYWDay4K7iAaIpUmltUT+esp4R00Nj1V3HMJoe3E1Mi477p2Xz8MPKj4YBreda7Q== X-Received: by 2002:a05:6402:2549:b0:5d0:d183:cc05 with SMTP id 4fb4d7f45d1cf-5d6323614dcmr1383768a12.5.1734032457412; Thu, 12 Dec 2024 11:40:57 -0800 (PST) Original-Received: from pro2 (p200300e0b71a7600d154e1b5a86cbe2e.dip0.t-ipconnect.de. [2003:e0:b71a:7600:d154:e1b5:a86c:be2e]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d3c270ccdasm9368695a12.63.2024.12.12.11.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 11:40:56 -0800 (PST) In-Reply-To: <817695b4-4b10-4e63-aab8-9ab450b2d671@gutov.dev> (Dmitry Gutov's message of "Thu, 12 Dec 2024 21:07:25 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x52b.google.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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:326443 Archived-At: Dmitry Gutov writes: > On 12/12/2024 05:49, Gerd M=C3=B6llmann wrote: > >> The Zed editor, which is heavily performance-oriented, decided to use >> ropes. They have are a number of blog entries that I find interesting, >> for example >> https://zed.dev/blog/zed-decoded-rope-sumtree > > IIUC their goal there was a use a data structure that can do everything. > > They also have an ambition to support live collaboration, which we > don't have anything for, and not for the reasons of performance. I don't find it surprising that being fast isn't the only requirement for a modern editor, TBH. Thing is that from what I observe, Zed seems to have no problem with long lines. But maybe that's a wrong observation. I never did anything that required long-line support. Point I was trying to make is that apparently ropes can support long lines. One could maybe learn from what they do; Rust sources are available, Of course, additional data structures like ones to make positions to actual text and so on belong into the picture. It not just using ropes, but in this case the rope is the basic data structure, and additional data structures depend on the properties of that. > >> VSCode uses persistent piece tables >> https://code.visualstudio.com/blogs/2018/03/23/text-buffer-reimplemen= tation > > And this article compared to the previous "array of strings" implementati= on. > And shows that they are using piece tables, the alternative to ropes, if one doesn't count the other two which are gap buffer and set of lines for the moment. And I think they got long-lines support working, too. And again there are additional data structure involved, and blah blah. > Both editors' data structures (not ropes) seem to have something that > can be used like our "newline cache", so if anything I would try to > understand whether either has an advantage in that area. For me that would be a too narrow perspective, I must admit. But I won't do anything in that area anyway, so please ignore me :-).