From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ilya Zakharevich Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] 5x speedup of flyspell-buffer Date: Thu, 13 Apr 2023 03:23:18 -0700 Message-ID: References: <837cug5l18.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21195"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 13 12:27:26 2023 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 1pmuAn-0005Hi-HS for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Apr 2023 12:27:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmuA4-0008Ru-6Z; Thu, 13 Apr 2023 06:26:40 -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 1pmu6u-0007Lf-TG for emacs-devel@gnu.org; Thu, 13 Apr 2023 06:23:24 -0400 Original-Received: from powdermilk.math.berkeley.edu ([169.229.140.13]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmu6r-0003w9-To; Thu, 13 Apr 2023 06:23:24 -0400 Original-Received: by powdermilk.math.berkeley.edu (Postfix, from userid 5260) id 60659120C74; Thu, 13 Apr 2023 03:23:18 -0700 (PDT) Content-Disposition: inline In-Reply-To: <837cug5l18.fsf@gnu.org> Received-SPF: none client-ip=169.229.140.13; envelope-from=serganov@math.berkeley.edu; helo=powdermilk.math.berkeley.edu X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 13 Apr 2023 06:26:38 -0400 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:305293 Archived-At: On Thu, Apr 13, 2023 at 09:54:59AM +0300, Eli Zaretskii wrote: > > Date: Wed, 12 Apr 2023 06:50:30 -0700 > > From: Ilya Zakharevich > > > > With the included patch, on my system flyspell-buffer speeds up 5 > > times. For my typical file sizes, this is 20sec -> 4sec on a 600K > > LaTeX file with 10,000 words detected by `aspell´ — which makes > > using flyspell feasible. > > > > The version is not the most recent, but IIUC, flyspell did not change. > > > > (The number 1.05 below is chosen to lower overhead of messages 50 times, > > from 5x to 0.1x. It is related to log(10000)/0.05 ∼ 10000/50.) > > Thanks, but does it indeed make sense to print these progress message > with logarithmically-increasing intervals? Why not simply decimate > the messages by printing them every N words or so? N could be > computed at the beginning of the command as function of the size of > the region to be spell-checked, assuming some suitable value of > average length of a word. WDYT? Without profiling, how to find out “how much overhead is tolerable to the user”?! Going logarithmic avoids all these complications. The REAL purpose of these messages is “the feedback to the user why the UI is locked now”. Thanks, Ilya P.S. BTW, there is very little need to lock the UI. On my (very old and slow) system, these 10,000 misspellings are reported in 300ms (even though aspell is cygwin — read “slow” — one). After this list of misspellings is swallowed, the rest of marking can be done asynchronously, via timers. I may try to find more time to investigate (and maybe implement) this…