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: MPS: dangling markers Date: Sat, 29 Jun 2024 19:09:03 +0200 Message-ID: References: <87v81u85hv.fsf@localhost> <87frsx81m2.fsf@localhost> <87cyo180y2.fsf@localhost> <874j9d7zqe.fsf@localhost> <87sewvg6lw.fsf@localhost> <86ed8fiug3.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="40071"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: yantar92@posteo.net, monnier@iro.umontreal.ca, emacs-devel@gnu.org, eller.helmut@gmail.com To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 29 19:10:09 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 1sNbaT-000AF5-KP for ged-emacs-devel@m.gmane-mx.org; Sat, 29 Jun 2024 19:10:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNbZc-0000cm-NL; Sat, 29 Jun 2024 13:09:17 -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 1sNbZW-0000b9-7T for emacs-devel@gnu.org; Sat, 29 Jun 2024 13:09:10 -0400 Original-Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sNbZT-0005oY-Du; Sat, 29 Jun 2024 13:09:09 -0400 Original-Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a727d9dd367so176146666b.3; Sat, 29 Jun 2024 10:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719680945; x=1720285745; 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=8iTeQBki+YjNs6J2udaa4cxkdgOLt3gEOBDmDwoE1pM=; b=HrIdjOGO8P9fMPtXO66EAjOXzcKOi4R1q/d0369rsXhEEZjDrtRRP/VTLe6jgsXSzl DnuObKSdE0ljPbTR88At46pUW2cbHNVpjyzuUs5E4UuV0P4dElcOJVu5RX0z70iqi7xz AvBxpk6Zf74Ijmf9dbxSRzZaxOFF1cEpfXVIcTdX8wHn5LN+oGsxeBlW9axKyo+6gvm5 AH/4RBebTsKqIPUmfeTT1yHT5OyLDQzQxyV4Ob3TK1Ui5ITwceMQo8zr5NGWwcjVSkCf JcwJDyou5WqZqmdHFfBZDg1b3+3nI8jarw3KGFgIjeCHk7UYBLrXPZELo5lswgdQO7Kw pQDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719680945; x=1720285745; 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=8iTeQBki+YjNs6J2udaa4cxkdgOLt3gEOBDmDwoE1pM=; b=fOpIJzPUDOG1cao2JkdiBqGlzfH9D5g0tCtKms06SKfthyI/4fRbYGtVeBgtDqL5tQ tJwVPERCHHLkMDZiMOjbkqA39XeRGUoyP/UsdqiY+yIEwxq7JAEjrGdrpSXczIROPv6a nguQkROZ6jHZ81+P8K0fm+4s5Eg4phAAFZQPnfTjw8s2CSS1DgjWEsPBjXTnH92KopNn JYwf99Gs1VJOz1LDmJJdZNkqvJIVM4GkRTf3msSjWlKf+KTe+yJuhRfGv3r4K3eYCn6i 4y9Qd8fTlTDjjVDVSVm/v2edSNNK7v+mk5piBvcihwxPQ/TDgjvYVmD7vojiC3juFHap mm0w== X-Forwarded-Encrypted: i=1; AJvYcCUy3H1RDVtRXmU0ssY+CyheqC3WWJb0K3TnVbWOdZYWnw3oXzYwruhf0wT12soOdRg0ADqG+SSsELLHgzKvYjcFO1Yw X-Gm-Message-State: AOJu0Yy/VdArR6y9uFm3fNoRrsWX/BTRaXDP3jW9IV0caFNHyrfWljUs dmCO+qYOR9ORWpCAMBOATkkCCDC8mQ39rwpXShEUUHqcNmBNr9sj X-Google-Smtp-Source: AGHT+IFnZYNgkHKwLr+nvJingXAsqjAqoxRxl9J2qif+rSJ4KPj5d0oxF5ARTQrRJAAS2MG8TForiQ== X-Received: by 2002:a17:906:ce29:b0:a6e:f793:461f with SMTP id a640c23a62f3a-a75144761b5mr96853266b.38.1719680945100; Sat, 29 Jun 2024 10:09:05 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e36598.dip0.t-ipconnect.de. [217.227.101.152]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72aaf1846esm177147566b.38.2024.06.29.10.09.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jun 2024 10:09:04 -0700 (PDT) In-Reply-To: <86ed8fiug3.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 29 Jun 2024 19:29:16 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x62f.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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:320867 Archived-At: Eli Zaretskii writes: >> From: Gerd M=C3=B6llmann >> Cc: Stefan Monnier , emacs-devel@gnu.org, Eli >> Zaretskii , eller.helmut@gmail.com >> Date: Sat, 29 Jun 2024 16:56:10 +0200 >>=20 >> Ihor Radchenko writes: >>=20 >> > I did a small perf benchmark generating large agendas multiple times, >> > and got the following output: >> > >> > 36.34% emacs emacs = [.] igc_remove_marker >> > 35.77% emacs emacs = [.] igc_add_marker >> > 3.41% emacs emacs = [.] buf_charpos_to_bytepos >> > 2.12% emacs emacs = [.] re_search_2 >> > 1.60% emacs emacs = [.] re_match_2_internal >> > 1.13% emacs emacs = [.] exec_byte_code >> > 0.95% emacs emacs = [.] buf_bytepos_to_charpos >> > >> > I guess O(N) is not all the fast, after all :) >>=20 >> Thanks for testing it, and yeah O(n) isn't that great. Bad is that I >> have no idea how to improve that ATM :-/. > > I think we can use a completely different data structure for > character-to-byte conversions. There's no need to use markers for > that, and there's no need to create extra markers. We could instead > maintain an itree of positions with their character and byte values, > as a field of 'struct buffer' that is not exposed to Lisp. > > WDYT? I must admit that my overview of that whole area is pretty limited. I only remember that markers were always kind of a problem :-). Would such a data structure be similar to recording deletions/insertions of buffer text? Or, maybe in other words, what would entries contain, and when would entries be inserted/removed/changed? (Somehow, this reminds me a bit of a piece table, if you remember, but without holding the text...) Anyway, it's a lot of work, of course. So far, with the kind of buffers I use I don't notice anything. I don't know if the figure of 500K markers is real, but that sounds erm strange...