From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#48581: 27.2; Default value of lazy-highlight-buffer-max-at-a-time is too low Date: Sat, 22 May 2021 12:49:16 +0200 Message-ID: <87eedzujpv.fsf@gmail.com> References: <87k0nr9l2f.fsf@gmail.com> <83eedzksqj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31511"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cc: 48581@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 22 12:50:13 2021 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 1lkPCu-0007uB-Ij for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 May 2021 12:50:12 +0200 Original-Received: from localhost ([::1]:49314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkPCs-0001WE-Sp for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 May 2021 06:50:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkPCl-0001W2-FM for bug-gnu-emacs@gnu.org; Sat, 22 May 2021 06:50:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55052) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lkPCk-0005dh-At for bug-gnu-emacs@gnu.org; Sat, 22 May 2021 06:50:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lkPCk-0000j8-7U for bug-gnu-emacs@gnu.org; Sat, 22 May 2021 06:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 May 2021 10:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48581 X-GNU-PR-Package: emacs Original-Received: via spool by 48581-submit@debbugs.gnu.org id=B48581.16216805672750 (code B ref 48581); Sat, 22 May 2021 10:50:02 +0000 Original-Received: (at 48581) by debbugs.gnu.org; 22 May 2021 10:49:27 +0000 Original-Received: from localhost ([127.0.0.1]:38365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkPCB-0000iI-9P for submit@debbugs.gnu.org; Sat, 22 May 2021 06:49:27 -0400 Original-Received: from mail-ed1-f50.google.com ([209.85.208.50]:35478) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkPC9-0000i2-0Z for 48581@debbugs.gnu.org; Sat, 22 May 2021 06:49:25 -0400 Original-Received: by mail-ed1-f50.google.com with SMTP id y7so8682710eda.2 for <48581@debbugs.gnu.org>; Sat, 22 May 2021 03:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=niC5I1nQy34+fgNb0cvlPQ/fOA8oeo/p20Ownk+O9fg=; b=UnrNAeuF0A6RMQb4CMWS1OI2KJTV4O80DJs39tEt/AWXeWa1iG/TYz2CPZV86Uw34q ZnRstjIk4D+OCU7qBuF16EN1qlqnaIrMluMKkJa6P+/7qdsMG7cRNAavLt+gBzwiyg9J 5lZ+tY1gak/K9JRbxjX6m24l8z14PgOqOd0gZaJNiUgqSnkruzXZbbqfl5Ww9P1WIjZq aYCMLIA/LPujeLBS1q1WxBq1yAvRqb1v2Y0O35MXcDcLBMzk0RLw+k4oQlqkAmcQpNzd M5WmvG2dexCB4G1Pp8gzQDVhXGet8JYvWXc0dpUA+sSkQYRr7GF3Xr31X1A7GJAvryHZ CgPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=niC5I1nQy34+fgNb0cvlPQ/fOA8oeo/p20Ownk+O9fg=; b=ZqPIvRpEkLmA8kzWGPkWV+BMTcPmpg+9l8IB0CzgkU879bmhkkvJq+m47dNEFRnHfD DxKJ1bTCi5oogFKs7S76EN32XY0hF/VUHJuvfpvE0EztiVXpo6bcEA5qUiMHnxh/uq4/ Z8zGBd7QXITwU0G2PQAzk+VL6Aya75JxuGfr6A6JB+1VQGfJFSV+gF0VfI+Uy9J/CuC2 Itg8U9bUnyEHAgDGjT69zDBtsLDeympMlEef+uxQNZZtnsap8rWVH6dbh3I8b+uHEwka QRoUtdxK+aL9uAHg42/+S24Eo441N4hJy+yDhdGPXrT844zrgGDGQhZiOMgvppTfB3D0 Vz+Q== X-Gm-Message-State: AOAM533UhSsKa1zYFi6Bx8gCo5oIze0r435dLYMaqcV2BDxX1KKfZg5S 5RxXdewJ1SvxHLEq38rQVAXjD71OdhFHow== X-Google-Smtp-Source: ABdhPJxVzFAK39YivqaeiIfybhJmEZSB+AkvbJUu2dHrv6a3YsVztEMkXuXo3tEFVhhYUYunmvk9PA== X-Received: by 2002:a50:d69c:: with SMTP id r28mr15696128edi.64.1621680558842; Sat, 22 May 2021 03:49:18 -0700 (PDT) Original-Received: from ars3 ([2a02:908:2211:8540::66]) by smtp.gmail.com with ESMTPSA id t17sm5687698edd.14.2021.05.22.03.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 May 2021 03:49:18 -0700 (PDT) In-Reply-To: <83eedzksqj.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 22 May 2021 12:44:36 +0300") 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" Xref: news.gmane.io gmane.emacs.bugs:207025 Archived-At: On Sat, 22 May 2021 at 12:44, Eli Zaretskii wrote: >> From: Augusto Stoffel >> Date: Sat, 22 May 2021 11:25:44 +0200 >> >> The value of lazy-highlight-buffer-max-at-a-time determines how long >> it takes to finish computing the isearch lazy count. The current >> default value of 20 seems suboptimal. >> >> I made a simple experiment measuring the (real) time to count the >> ~15000 matches of the string "e" in the file isearch.el, with the >> following results: >> >> lazy-highlight-buffer-max-at-a-time | time to finish counting >> 20 (current setting) | 1.5 s >> 50 | 0.8 s >> 100 | 0.6 s >> 200 | 0.5 s >> nil (do it all at once) | 0.4 s >> >> Based on this, I would like to suggest changing the default to 200, or >> something in that order of magnitude. > > You assume that (a) the main purpose of Isearch is to count the > matches, No, the main purpose of Isearch is to search for a string :-). `isearch-lazy-highlight-buffer-update' has more than one purpose, but I assume that finishing faster is always better than taking longer than necessary. > and (b) that a case with 15,000 matches is the common one? No, that was just so I that the measured time is not too small. However, the delay before the lazy count appears in the echo area during day-to-day Isearch operation is noticeable to the naked eye. If you keep looking, you will notice it. Note that the precise value of this parameter is irrelevant, only the order of magnitude plays a significant role. I don't think there's a need to do a more formal benchmark to conclude 20 is to small and 2000 is probably too big. > >> The downside of this change would be an increase in the time Emacs is >> unresponsive doing lazy counting/highlighting. However, this time >> remains below a few milliseconds in a typical case > > What kind of CPU do you have there, A decent but not particularly powerful laptop from 2019. > and how many milliseconds does it take Emacs to highlight 20 vs 200 > matches? I didn't specifically compute that, but you can get an upper bound based on the provided data: 2 ms for 20 matches and 6.7 ms for 200 matches.