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:02:42 +0300 Message-ID: <83sfcpy23x.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="37785"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63040@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 24 13:06:20 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 1pqu1T-0009eG-Ub for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Apr 2023 13:06:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqtyW-0000MM-Nr; Mon, 24 Apr 2023 07:03:16 -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 1pqtyI-0008PL-Gk for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 07:03:05 -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 1pqtyI-0000H5-5K for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 07:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pqtyI-0005SH-0Z for bug-gnu-emacs@gnu.org; Mon, 24 Apr 2023 07:03: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:03:01 +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.168233416120942 (code B ref 63040); Mon, 24 Apr 2023 11:03:01 +0000 Original-Received: (at 63040) by debbugs.gnu.org; 24 Apr 2023 11:02:41 +0000 Original-Received: from localhost ([127.0.0.1]:47666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqtxw-0005Rh-V1 for submit@debbugs.gnu.org; Mon, 24 Apr 2023 07:02:41 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pqtxi-0005RD-J6 for 63040@debbugs.gnu.org; Mon, 24 Apr 2023 07:02:39 -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 1pqtxc-0000Ag-41; Mon, 24 Apr 2023 07:02:20 -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=QzwZFK3AB0F6/ZbByAoPBVJSfCHTEW+7PrN0ySIU40k=; b=KRy/vYiIzHt+ atpBNTF3MZ42ZASVtlm21X4lRPRGk71rSZvr9kNVOmWTJXPcm3fpvcSQCGRDRO61DL6pllGbpyEt/ syA4vSrMxigqrSQqlep8MUsqZqrQ7uFzZW3wrjz+fo9fCOkEm3IkE/zAZq+CRCkU+kSrlUToI7izB okug3DkSpW7WFxqzanfJBZY19AH62He0+fmOp8Xx3xVOoRBmTIpxmTM2fDT+NM6sHDXOWIvx6Us3D OQz2DIT6RjcNoo04bVkPrCrmp0s2+13YLSOpVbdF5PzqJ2L6c8AJxpKZVPOcKPnzMl4LJeWZDp8/T gfrqvUrRV7HXpPPQ2OwkGA==; 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 1pqtxa-000103-Tp; Mon, 24 Apr 2023 07:02:19 -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:260558 Archived-At: > 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.