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#70216: 30.0.50; self-insert-command doesn't respect create-lockfiles Date: Sun, 07 Apr 2024 09:31:42 +0300 Message-ID: <86frvx1y5t.fsf@gnu.org> References: <87zfu8w07c.fsf@thornhill.no> <868r1s55cs.fsf@gnu.org> <87il0up4bv.fsf@thornhill.no> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18659"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70216@debbugs.gnu.org To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 07 08:33:39 2024 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 1rtM5y-0004WS-4a for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Apr 2024 08:33:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtM5O-0004Fa-BU; Sun, 07 Apr 2024 02:33:02 -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 1rtM5J-0004FC-55 for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2024 02:32:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtM5H-0002JR-MY for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2024 02:32:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rtM5O-0004ji-2r for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2024 02:33: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: Sun, 07 Apr 2024 06:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70216 X-GNU-PR-Package: emacs Original-Received: via spool by 70216-submit@debbugs.gnu.org id=B70216.171247152417971 (code B ref 70216); Sun, 07 Apr 2024 06:33:02 +0000 Original-Received: (at 70216) by debbugs.gnu.org; 7 Apr 2024 06:32:04 +0000 Original-Received: from localhost ([127.0.0.1]:41449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rtM4P-0004fK-TS for submit@debbugs.gnu.org; Sun, 07 Apr 2024 02:32:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rtM4L-0004eK-KB for 70216@debbugs.gnu.org; Sun, 07 Apr 2024 02:32:01 -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 1rtM49-0001vS-29; Sun, 07 Apr 2024 02:31:45 -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=FKtV/gUYULGDYhfSOg1lxHyAGihhfYZr2zUw23HQFkY=; b=U685W1ge713E MwSZjHAkUmfOWfAM/ml1xmiV0/ifLyrKWLuVrtZ3qTaMBUEwQmbzmtSymGnogFcar6pmOKIv6OT8d JpThJDarD2Cx6RDWyY3QW+CWTN0zlMPHo7y0oX8v8z+4g1Az8E9+/DqDe+OUnr4b9dVyzpVouq0WO nnBKhKipiii5Mwqz8aD3ypIEKGBqQPDHRH26IqBDD5UCFaZeipd8GU/6lr2MvmJfp0evxpCC68pxl QSnGJxl0Mrp1tpAjoPe7NzRc9woPe+D/iwJYvnxcKEACvCAzkgD3yx77/SyYfDQ2wEoQ68nDjvV47 C7XhncZTjShFuZ6Rh2YsBg==; In-Reply-To: <87il0up4bv.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 06 Apr 2024 23:29:56 +0200) 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:282843 Archived-At: > From: Theodor Thornhill > Cc: 70216@debbugs.gnu.org > Date: Sat, 06 Apr 2024 23:29:56 +0200 > > >> The documentation states: > >> ``` > >> If the option `create-lockfiles' is nil, this does nothing. > >> ``` > > > > I guess we need to fix the documentation, then. > > > > Sure ;) Done on the emacs-29 branch. > > Lock files and file-change detection are Emacs safety measures that > > are important on any modern OS. Disabling them because they eat up > > CPU cycles is wrong, from where I stand. That said, hundreds of > > milliseconds for 2 calls to 'stat' sounds excessive to me, so please > > tell more details and try to show the breakdown of this long time. > > > > Sure! So it all starts in prepare_to_modify_buffer, where we run the > verify_internal_modification. This is pretty fast, in the order of ~10 > microseconds. Next up is the Flock_file, which delegates to > lock_file. Before jumping into lock_file we run Ffind_file_name_handler, > which takes between 50 and 200 microseconds on my system, depending on > general load, I assume. now we jump into lock_file, from which we inside > Fverify_visited_file_modtime run Ffind_file_name_handler for good > measure, for another 50-200microseconds. > > This to me looks like _at least_ one too many calls to > Ffind_file_name_handler causing almost half a millisecond on keypress, > which sounds very excessive. The extra call is only when the file is local. And losing 50 to 200 microseconds doesn't sound bad to me. Also, we don't call lock-file on each keystroke, only on the first one that makes the buffer modified when it was previously unmodified. So when you type several characters in sequence, the net slowdown will be very small. In any case, you originally said this took hundreds of milliseconds, not hundreds of microseconds. Was that a typo, and you really meant microseconds? > If you're interested, take this trace file and plop it into > https://magic-trace.org and search for self_insert_command and move > around with wasd. Hmm... you just sent a 15MB file, uncompressed, to everyone who is subscribed to bug-gnu-emacs...