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:17:21 +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="39613"; 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:18:01 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 1sNbi5-000A5z-3X for ged-emacs-devel@m.gmane-mx.org; Sat, 29 Jun 2024 19:18:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNbhe-0002S3-Lm; Sat, 29 Jun 2024 13:17:34 -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 1sNbhY-0002Oa-HG for emacs-devel@gnu.org; Sat, 29 Jun 2024 13:17:30 -0400 Original-Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sNbhW-0004CA-SK; Sat, 29 Jun 2024 13:17:28 -0400 Original-Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-52cd717ec07so2031810e87.0; Sat, 29 Jun 2024 10:17:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719681443; x=1720286243; 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=gfcPm+8mX6jlMvVP6RPL2TnG2pdknHhifMNJamDp/YA=; b=nAE0q+cPVZV13jd5MtLzP7ijjWRbK0v+6v1swuDMl1rJOh6xpq0NlbsjNPqVho4jpR 4goa6BM7cDXQK0jFq462YF+v+xf9+K/H3LvK3A98LtyJg9m30VXymF/Mh3RmephRBvYZ zOzs7QhO+8RTmdoq6lLNBbE6Z+yFf1RUqmbUqFbO2L0rE0Qj4qfX3/Zj2AuMmSzUEbHy 7JW0qvttetKgItoeyQQ19zeCwCBO9SbzSxeRpOmI2aDAqNVNkJiOnzfSl/Wxpoq/bEaf ge6kYG2KkuR755MIauFLUgP/5fQ0dHpa1jDqyngo9+UaGDmItaqPn3OlIWMoswaag+w0 LtRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719681443; x=1720286243; 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=gfcPm+8mX6jlMvVP6RPL2TnG2pdknHhifMNJamDp/YA=; b=a6RdDAGYRexWyJuIe/s83uxtYLsH6JMIVdZM3tLcCkBhnPycwYI8OvcBAweCW0BGnJ 6pVRM9reKwNZX5fGDXEnzeUpyZqr53c4PNTPk2fJfpSKJRNxEqlHeXriaMWYsJr2qVBA NRAWEo+J/NwQg7wbbjnxkpaqOGxjnlb/FPUO9fpq/hmDceQCY2zgfSv+KVS57HzV8xbM TKABs52lTadAMRrZjXAJO9hmTlSYBe2nmoo4qiFfeL2h6JOLEdllVwlUkHkoex0MPEKq /fFKQtPziAa/xwcpsxpEgZUSo8Ot+Jgd91lGDGV5XtINEXTwYxpiOW2OcNMBVH9PjG/A ANAA== X-Forwarded-Encrypted: i=1; AJvYcCXQUGTEh/C51QNeDFAlbC+qWyUkR1S0Jd4fuIRJxddO9OEFsfVt6Qvd+sgE4PaaZXxPt5oQksw/0eDWycdmjx3Z6zyF X-Gm-Message-State: AOJu0YwmU4MqAuZa2sHS7QHlZ/XLuMBRbs1qp7/227rj53lWbGvvndSU FCVAa0nBIwT5LerVzst9mMN/NxTx31jUCKm6By+0NAoa+CNZ6xOK X-Google-Smtp-Source: AGHT+IHUpfjUjCoR0fkeO4ON73+bKMCP+DWCauM+eygeyCZiaZz8WuaMa/LeXgvjQkiY/F42lpM8Cw== X-Received: by 2002:a19:e010:0:b0:52c:d84b:eee6 with SMTP id 2adb3069b0e04-52e826932e5mr861184e87.38.1719681443152; Sat, 29 Jun 2024 10:17:23 -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-a72aaf1ba9dsm176600766b.29.2024.06.29.10.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jun 2024 10:17:22 -0700 (PDT) In-Reply-To: ("Gerd =?utf-8?Q?M=C3=B6llman?= =?utf-8?Q?n=22's?= message of "Sat, 29 Jun 2024 19:09:03 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=gerd.moellmann@gmail.com; helo=mail-lf1-x12c.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:320869 Archived-At: Gerd M=C3=B6llmann writes: > Eli Zaretskii writes: > >>> From: Gerd M=C3=B6llmann >>> Cc: Stefan Monnier , emacs-devel@gnu.org, E= li >>> 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... And let me add a question: do we know for sure that these markers stem from char<->byte position code?