From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63040: 30.0.50; Performance of buf_bytepos_to_charpos when a buffer has large number of markers Date: Mon, 24 Apr 2023 14:03:17 +0300 Message-ID: <83r0s9y22y.fsf@gnu.org> References: <878reiwfm3.fsf@localhost> <83wn22xbj9.fsf@gnu.org> <87bkjdzt0o.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35025"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63040@debbugs.gnu.org To: Ihor Radchenko , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 24 13:05:49 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pqu0z-0008u5-AJ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Apr 2023 13:05:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqtzK-0001Ny-DD; Mon, 24 Apr 2023 07:04:06 -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 1pqtzG-0001Bp-Qd for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 07:04:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqtzG-0000PG-EQ for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 07:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pqtzG-0005Ty-9N for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 07:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Apr 2023 11:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63040 X-GNU-PR-Package: emacs Original-Received: via spool by 63040-submit@debbugs.gnu.org id=B63040.168233419521013 (code B ref 63040); Mon, 24 Apr 2023 11:04:02 +0000 Original-Received: (at 63040) by debbugs.gnu.org; 24 Apr 2023 11:03:15 +0000 Original-Received: from localhost ([127.0.0.1]:47671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqtyU-0005Sr-Fv for submit@debbugs.gnu.org; Mon, 24 Apr 2023 07:03:15 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqtyF-0005S2-FI for 63040@debbugs.gnu.org; Mon, 24 Apr 2023 07:03:14 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqty9-0000Fx-Bm; Mon, 24 Apr 2023 07:02:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=bC5ZIbE/4+//Gw9dWOGAe+LhO5tVMRDoscD5hWxmj9I=; b=hjud5E/49lSK XsHGcVN0declldmqy95XLNjwBrK/0cUMe2u5T+5krpMNfPCO78cJ8vGTkDRJHOUqhbjogTDvcPTAi 2nEHy6xAM/As40c+JAgMqeonWsReXy/Mtu+bZuyEhzZJutdnkfAMQpkWHGfaHvyHpFLBiKu2eyUba 6alKUDY96lxrqS/N+wzdcA+pMmRhN7+o841nZGVWCN0dngf6upzLPmk+HHMm3WwKr4cQoK+6VeN/B OZr9DfHDvAqTE8CarKyecVLwL3qeBPU4urHiyfPp6PRIhbLUaINqG3BZpymrmPyjiIz4sH3Weh3Dv xkarHgFtu+zwsbVGXAWB9A==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqty8-00039a-Ll; Mon, 24 Apr 2023 07:02:52 -0400 In-Reply-To: <87bkjdzt0o.fsf@localhost> (message from Ihor Radchenko on Mon, 24 Apr 2023 06:36:07 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260557 Archived-At: [Resending with Stefan added.] > From: Ihor Radchenko > Cc: 63040@debbugs.gnu.org > Date: Mon, 24 Apr 2023 06:36:07 +0000 > > > Interesting. Would it be possible to show the effect of different > > values of the cut-off on the performance, so we could decide which > > value to use? > > I can do such test, but I do not think that playing with cut off is the > best approach here. > > The full code in question is below and there is already existing > condition to cut the marker loop early based on the distance from > best_above to the requested bytepos. So, another approach could be > playing with BYTECHAR_DISTANCE_INCREMENT. Yes, that would be an even better idea, IMO. > Now, it is clearly not efficient enough for my large file. Why do you say that? Did you try something and the results were unsatisfactory? And what is not efficient enough -- the cutoff based on the number of markers tested or based on the distance? > Further, the later code creates markers to cache recent results and > cutting too early may waste this cache. And the technique that you tried doesn't waste the cache? > Another idea could be moving the cache markers into a separate > array, so that we can examine them without mixing with all other > buffer markers. Why would that separation be useful? Thanks.