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: Wed, 11 Dec 2024 10:35:29 +0100 Message-ID: References: <8634iyf257.fsf@gnu.org> <8634iwex8q.fsf@gnu.org> <86wmg7bso1.fsf@gnu.org> <87cyhzmzbp.fsf@telefonica.net> <87bjximwnj.fsf@protonmail.com> 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="21416"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: "Pip Cet via \"Emacs development discussions.\"" , =?utf-8?Q?=C3=93scar?= Fuentes To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Dec 11 10:36:42 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 1tLJ98-0005S4-71 for ged-emacs-devel@m.gmane-mx.org; Wed, 11 Dec 2024 10:36:42 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLJ85-0001Ko-1k; Wed, 11 Dec 2024 04:35:37 -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 1tLJ82-0001KX-Vu for emacs-devel@gnu.org; Wed, 11 Dec 2024 04:35:35 -0500 Original-Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLJ81-00039R-Cs for emacs-devel@gnu.org; Wed, 11 Dec 2024 04:35:34 -0500 Original-Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-434a736518eso72083475e9.1 for ; Wed, 11 Dec 2024 01:35:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733909731; x=1734514531; 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=UCK3BkwRE3a0WC8LNbICn8KDmaHXfDRh4cEmEfVo06Q=; b=R5Rruk+CuaB2oScx2gy8OrawaiG1JWRZgZI/5rwTp70uAN24f5sA2LvuGiSo0pSegd 92jUXSRfsUVd9pS66x8VLZRUuda4VQQGZYf/Kq51uEtZPPdFPlLrdDR2FNjmh8E6D21W 4kM0JAhec6fNVQWJlO3QORm9CqiZJSeAu6Izy6A/3RXn7kN5+TLIeKbhmjMY0uRyhO0V lXyIEN4t1uC0mUR6p6pCQ6j8nYqMR5UdhEiMKePEj5g/yHRfutaIS7q4SRg3r6FN/Uau ZjchdFIjVSM14arDH1gGr0gzr+gzPQlpcv9H3UK1MpUAi6DwJHmgwx1mlz/pvMfr+1hJ /r0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733909731; x=1734514531; 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=UCK3BkwRE3a0WC8LNbICn8KDmaHXfDRh4cEmEfVo06Q=; b=B1JwpK38z1sLkqjz9MjtrueUTQnprdGDUSjtp1rglVZ4wFvDDSr6kkD5YkZvIPgzka B1xfdexf/oNtnWIWz+ixxzYWfeCPggzuuLt/Pu26aDhometrFb1ojl1f0CRyFu+QG+Sx Bu26FNeNGaJDFyhV6d3L26LzVPFInxLM/OsR5sm3umWURcjV6w39QDvSUMhVadMCtkeF 6lnFSjadYH+hbc2rY/U697p6wi8FyL+P7ax/q1M4rk4fSyjgafWM1SIY1U62il9uRyhH dRCvYHVd9nTj2ns6fOAdpfccfUiBVY1ldFAZyJUfViWrFINsimdebzEr6usAfvviKELe 3eKw== X-Gm-Message-State: AOJu0YyF+75F56tkvmyhr75myFePpSKOYFcL/G+nt6PqABxia9ipXBFx 8OG2EUMSsfgeK1yVqXog+bE5rY8ET5atoBDR1wh28dj4PbNP5TBc X-Gm-Gg: ASbGncsrvCwcOEr16HnLJ6Hp1xxxxQU+zjQ9wONUk4X9PL9uKKJjoOctbr8qa8MaKgE FagafYT6Tqfl75aH5jJkT0eaVgVspzkM5wvAvUXBt6RS+eEXguXqNlSJFMayfEkDE2tTJDQG7AF bdQFRQ13QltPZom01o3aoDU0xDZAI/P2riw17+UGL3jnjC20KFq1YIku59AV8QYtBVUOEgQfO6V yuh3P7kLoT2ReCUKj8TlnIzEap0ThOEkG7QCxUHOf5imXIHSQ6+Hh5EyO+1mVW0bkzEW1lYsURf MnWajl69GwHf41lItLuaaHnKxDUkZLT713LG7wunelYXxxJ5WpJ6aUaCBdDl9ZA= X-Google-Smtp-Source: AGHT+IF8RvN7WKepJT6/64HovFrh/qyBSDFcb4pCr0dB1q8aX35Kmkw1TozmvfzjFr8MdQ6YafDFyQ== X-Received: by 2002:a05:600c:4fd3:b0:436:1c04:aa8d with SMTP id 5b1f17b1804b1-4361c393ca0mr14977355e9.1.1733909731211; Wed, 11 Dec 2024 01:35:31 -0800 (PST) Original-Received: from pro2 (p200300e0b709ba00c5d5596d9959c8a7.dip0.t-ipconnect.de. [2003:e0:b709:ba00:c5d5:596d:9959:c8a7]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4361f511cfbsm8589085e9.20.2024.12.11.01.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 01:35:30 -0800 (PST) In-Reply-To: <87bjximwnj.fsf@protonmail.com> (Pip Cet's message of "Wed, 11 Dec 2024 08:50:40 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=gerd.moellmann@gmail.com; helo=mail-wm1-x333.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:326334 Archived-At: Pip Cet writes: > Gerd M=C3=B6llmann writes: > >> Pip Cet via "Emacs development discussions." >> writes: >> >>> On Tuesday, December 10th, 2024 at 13:39, =C3=93scar Fuentes wrote: >>>> Eli Zaretskii eliz@gnu.org writes: >>>> > Maybe so, but why is such a long wait a problem? GC works, and >>>> > works well. >>>> >>>> Working on certain projects with lsp-mode is a miserable experience due >>>> to all the random pauses. >>> >>> To be fair, part of that may be the gap buffer problem rather than GC. >> >> Could you please tell more about the gap buffer problem? > > Just anecdotes, I'm afraid. My problem was a large buffer of test > descriptions for a programming language, and I was running the tests and > modifying the buffer to contain the output for each test in a block > after the test itself. That worked, but running several tests in > parallel, moving back and forth in the buffer to modify text as the > output came in ... not so much. > > I also recall discussion somewhere (nullprogram.com, maybe) about > multiple cursors and the gap buffer, and that's also a potential use > case where the gap buffer would make things very slow. Thanks. > >> I've read a little about the tradeoffs between gap buffers, piece >> tables, ropes, but I'm wondering if there is something concrete already >> known for sure that is a performance problem in Emacs. Maybe a bug that >> has been analyzed or something. > > I'd be very interested in such a bug. Replacing the gap buffer > assumption is quite hard: IIRC, the main problem is that the regexp code > has been hacked to support gap buffers but not other data structures, so > we'd need to do something about that. > >> (I'm asking because I just recently encountered a performance problem >> when adding something to xdisp.c:27339 (with cc-mode, Eglot, Corfu), and >> editing there was so slow that it was absolutely no fun, and that on a >> an M1 pro. Haven't investigated the reason.) > > Interesting. It may be worth it to try reproducing that and disabling > modes one by one to find out which one is at fault. I suspect that it's > overlays/the interval tree rather than the gap buffer per se (however, Yeah, maybe I'll investigate that further at some point, not sure. I did try with VSCode and Zed now, though, for no good reason. They don't have a problem. > if we ever replace the gap buffer code, we should make sure its > replacement actually handles buffer text and text properties/intervals > in an integrated manner, rather than storing just buffer text). > > Pip And if I may add a wish to the future author: Make whatever you use=20 persistent data structures, so that one could think of letting redisplay run concurrently. Really! :-)