* bug#29846: scroll and fontify takes longer time for file in slow network
@ 2017-12-25 6:03 Shuguang Sun
2017-12-25 9:47 ` Shuguang Sun
2017-12-27 20:49 ` Stefan Monnier
0 siblings, 2 replies; 9+ messages in thread
From: Shuguang Sun @ 2017-12-25 6:03 UTC (permalink / raw)
To: 29846
[-- Attachment #1: Type: text/plain, Size: 1396 bytes --]
Hi,
Windows 7, GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2017-12-09.
Issue:
I have remote dirver (//server/path) mapped to my windows system (samba?).
The network is slow, and it takes some time to open the file. However,
after I have the file opened and scroll down, it takes a long time to
scroll to the next screen. It gets worse if the jit-lock-debug-mode is on.
After that if I try to scroll back to those has been fontified, it get
fluent as expected.
If I open the same file in a local driver (speed is higher than the network
definitely), the scroll is very fluent.
If I open a txt file (fundmental-mode, not fontification) in the same
remote directory, the scroll actions are fluent as well.
Per my understanding, all actions should be done in memory when a file has
been read into buffer, except backup, autosave, etc. The response should
not depents on where the file located phically.
How to repeat it:
1. Find a slow transfer rate network (sorry, it may be hard)
2. Prepare a long c file, 3-4 screens.
3. take font-lock-mode on (jit-font-mode)
4. Open the c file and scroll down, scroll down, scroll down...
5. scroll up, scroll up, scroll up
I have tried profiler. It indicates, the jit-font and redisplay take
majority of the cpu time.
1. open the c file
2. profiler-start
3. scroll down, scroll down, scroll down...
4. profiler-report
Best Regards,
Shuguang Sun
[-- Attachment #2: Type: text/html, Size: 1793 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29846: scroll and fontify takes longer time for file in slow network
2017-12-25 6:03 bug#29846: scroll and fontify takes longer time for file in slow network Shuguang Sun
@ 2017-12-25 9:47 ` Shuguang Sun
2017-12-25 12:28 ` Eli Zaretskii
2017-12-25 16:48 ` Eli Zaretskii
2017-12-27 20:49 ` Stefan Monnier
1 sibling, 2 replies; 9+ messages in thread
From: Shuguang Sun @ 2017-12-25 9:47 UTC (permalink / raw)
To: shuguang, 29846
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
Backup, auto-save, and lockfiles has been disabled in .dir-locals
((nil
(make-backup-files . nil)
(create-lockfiles . nil)
(auto-save-default . nil)
(auto-save-timeout . 10000)
))
Best Regards,
Shuguang
[-- Attachment #2: Type: text/html, Size: 325 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29846: scroll and fontify takes longer time for file in slow network
2017-12-25 9:47 ` Shuguang Sun
@ 2017-12-25 12:28 ` Eli Zaretskii
2017-12-25 14:41 ` Shuguang Sun
2017-12-25 16:48 ` Eli Zaretskii
1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2017-12-25 12:28 UTC (permalink / raw)
To: 29846, shuguang, shuguang
On December 25, 2017 11:47:52 AM GMT+02:00, Shuguang Sun <shuguang@gmail.com> wrote:
> Backup, auto-save, and lockfiles has been disabled in .dir-locals
>
> ((nil
> (make-backup-files . nil)
> (create-lockfiles . nil)
> (auto-save-default . nil)
> (auto-save-timeout . 10000)
> ))
>
> Best Regards,
> Shuguang
Did you try setting auto-save-interval to a large value, in addition to above?
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29846: scroll and fontify takes longer time for file in slow network
2017-12-25 12:28 ` Eli Zaretskii
@ 2017-12-25 14:41 ` Shuguang Sun
0 siblings, 0 replies; 9+ messages in thread
From: Shuguang Sun @ 2017-12-25 14:41 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 29846
[-- Attachment #1: Type: text/plain, Size: 192 bytes --]
>
> Did you try setting auto-save-interval to a large value, in addition to
> above?
>
No difference.
Otherwise, it will not get smoothly to scroll back to those has been viewed
/ fontified.
[-- Attachment #2: Type: text/html, Size: 565 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29846: scroll and fontify takes longer time for file in slow network
2017-12-25 9:47 ` Shuguang Sun
2017-12-25 12:28 ` Eli Zaretskii
@ 2017-12-25 16:48 ` Eli Zaretskii
2017-12-26 1:04 ` Shuguang Sun
1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2017-12-25 16:48 UTC (permalink / raw)
To: Shuguang Sun; +Cc: 29846
> From: Shuguang Sun <shuguang@gmail.com>
> Date: Mon, 25 Dec 2017 17:47:52 +0800
>
> Backup, auto-save, and lockfiles has been disabled in .dir-locals
>
> ((nil
> (make-backup-files . nil)
> (create-lockfiles . nil)
> (auto-save-default . nil)
> (auto-save-timeout . 10000)
> ))
You've disabled file locking, but Emacs still checks whether some
other Emacs session locked the file. It does that as part of
restore-buffer-modified-p, which is called by JIT font-lock (because
fontification makes the buffer modified and JIT font-lock needs to
undo that after it fontifies a chunk of buffer). Checking whether a
file is locked entails calling unlock_file, which in turn calls
read_lock_data, which tries to open the lock file. I'm guessing that
this is slow on that remote volume of yours.
Maybe we should support a special value of create-lockfiles which
would mean don't create lockfiles and don't test fro lockfiles created
by other Emacs sessions.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29846: scroll and fontify takes longer time for file in slow network
2017-12-25 16:48 ` Eli Zaretskii
@ 2017-12-26 1:04 ` Shuguang Sun
0 siblings, 0 replies; 9+ messages in thread
From: Shuguang Sun @ 2017-12-26 1:04 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 29846
[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]
On Tue, Dec 26, 2017 at 12:48 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Shuguang Sun <shuguang@gmail.com>
> > Date: Mon, 25 Dec 2017 17:47:52 +0800
> >
> > Backup, auto-save, and lockfiles has been disabled in .dir-locals
> >
> > ((nil
> > (make-backup-files . nil)
> > (create-lockfiles . nil)
> > (auto-save-default . nil)
> > (auto-save-timeout . 10000)
> > ))
>
> You've disabled file locking, but Emacs still checks whether some
> other Emacs session locked the file. It does that as part of
> restore-buffer-modified-p, which is called by JIT font-lock (because
> fontification makes the buffer modified and JIT font-lock needs to
> undo that after it fontifies a chunk of buffer). Checking whether a
> file is locked entails calling unlock_file, which in turn calls
> read_lock_data, which tries to open the lock file. I'm guessing that
> this is slow on that remote volume of yours.
>
> Maybe we should support a special value of create-lockfiles which
> would mean don't create lockfiles and don't test fro lockfiles created
> by other Emacs sessions.
>
It makes sense. It has a short delayed reponse when I start to modify the
buffer (input, delete, etc.).
It will help single user if we can have a special value of create-lockfiles.
[-- Attachment #2: Type: text/html, Size: 1893 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29846: scroll and fontify takes longer time for file in slow network
2017-12-25 6:03 bug#29846: scroll and fontify takes longer time for file in slow network Shuguang Sun
2017-12-25 9:47 ` Shuguang Sun
@ 2017-12-27 20:49 ` Stefan Monnier
2017-12-28 16:21 ` Eli Zaretskii
1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2017-12-27 20:49 UTC (permalink / raw)
To: Shuguang Sun; +Cc: 29846
> I have remote drive (//server/path) mapped to my windows system (samba?).
> The network is slow, and it takes some time to open the file. However,
> after I have the file opened and scroll down, it takes a long time to
> scroll to the next screen. It gets worse if the jit-lock-debug-mode is on.
> After that if I try to scroll back to those has been fontified, it get
> fluent as expected.
I believe this bug was introduced by yours truly
in commit 6bc76cee212aab0a2c02f8c28213fc842cc7880f:
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Tue Apr 8 21:48:07 2014 -0400
* src/insdel.c (prepare_to_modify_buffer_1): Cancel lock-file checks and
region handling (and don't call signal_before_change) if
inhibit_modification_hooks is set.
(signal_before_change): Don't check inhibit_modification_hooks any more.
* lisp/subr.el (with-silent-modifications): Don't bind deactivate-mark,
buffer-file-name, and buffer-file-truename any more.
And I think the patch below hence belongs in emacs-26. Any objection?
Stefan
diff --git a/src/buffer.c b/src/buffer.c
index 75cb470af8..f518e72f9e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1346,7 +1346,6 @@ It is not ensured that mode lines will be updated to show the modified
state of the current buffer. Use with care. */)
(Lisp_Object flag)
{
- Lisp_Object fn;
/* If buffer becoming modified, lock the file.
If buffer becoming unmodified, unlock the file. */
@@ -1355,15 +1354,18 @@ state of the current buffer. Use with care. */)
? current_buffer->base_buffer
: current_buffer;
- fn = BVAR (b, file_truename);
- /* Test buffer-file-name so that binding it to nil is effective. */
- if (!NILP (fn) && ! NILP (BVAR (b, filename)))
+ if (!inhibit_modification_hooks)
{
- bool already = SAVE_MODIFF < MODIFF;
- if (!already && !NILP (flag))
- lock_file (fn);
- else if (already && NILP (flag))
- unlock_file (fn);
+ Lisp_Object fn = BVAR (b, file_truename);
+ /* Test buffer-file-name so that binding it to nil is effective. */
+ if (!NILP (fn) && ! NILP (BVAR (b, filename)))
+ {
+ bool already = SAVE_MODIFF < MODIFF;
+ if (!already && !NILP (flag))
+ lock_file (fn);
+ else if (already && NILP (flag))
+ unlock_file (fn);
+ }
}
/* Here we have a problem. SAVE_MODIFF is used here to encode
^ permalink raw reply related [flat|nested] 9+ messages in thread
* bug#29846: scroll and fontify takes longer time for file in slow network
2017-12-27 20:49 ` Stefan Monnier
@ 2017-12-28 16:21 ` Eli Zaretskii
2017-12-28 19:03 ` Stefan Monnier
0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2017-12-28 16:21 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 29846, shuguang
> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Date: Wed, 27 Dec 2017 15:49:56 -0500
> Cc: 29846@debbugs.gnu.org
>
> > I have remote drive (//server/path) mapped to my windows system (samba?).
> > The network is slow, and it takes some time to open the file. However,
> > after I have the file opened and scroll down, it takes a long time to
> > scroll to the next screen. It gets worse if the jit-lock-debug-mode is on.
> > After that if I try to scroll back to those has been fontified, it get
> > fluent as expected.
>
> I believe this bug was introduced by yours truly
> in commit 6bc76cee212aab0a2c02f8c28213fc842cc7880f:
>
> Author: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Tue Apr 8 21:48:07 2014 -0400
>
> * src/insdel.c (prepare_to_modify_buffer_1): Cancel lock-file checks and
> region handling (and don't call signal_before_change) if
> inhibit_modification_hooks is set.
> (signal_before_change): Don't check inhibit_modification_hooks any more.
> * lisp/subr.el (with-silent-modifications): Don't bind deactivate-mark,
> buffer-file-name, and buffer-file-truename any more.
>
> And I think the patch below hence belongs in emacs-26. Any objection?
LGTM, please push to emacs-26.
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#29846: scroll and fontify takes longer time for file in slow network
2017-12-28 16:21 ` Eli Zaretskii
@ 2017-12-28 19:03 ` Stefan Monnier
0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2017-12-28 19:03 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 29846-done
>> I believe this bug was introduced by yours truly
>> in commit 6bc76cee212aab0a2c02f8c28213fc842cc7880f:
[...]
>> And I think the patch below hence belongs in emacs-26. Any objection?
> LGTM, please push to emacs-26.
Installed,
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-12-28 19:03 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-25 6:03 bug#29846: scroll and fontify takes longer time for file in slow network Shuguang Sun
2017-12-25 9:47 ` Shuguang Sun
2017-12-25 12:28 ` Eli Zaretskii
2017-12-25 14:41 ` Shuguang Sun
2017-12-25 16:48 ` Eli Zaretskii
2017-12-26 1:04 ` Shuguang Sun
2017-12-27 20:49 ` Stefan Monnier
2017-12-28 16:21 ` Eli Zaretskii
2017-12-28 19:03 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.