emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs-26 eec71eb: Speed up replace-buffer-contents


From: Eli Zaretskii
Subject: Re: emacs-26 eec71eb: Speed up replace-buffer-contents
Date: Wed, 04 Jul 2018 05:31:21 +0300

> Cc: address@hidden, address@hidden
> From: Paul Eggert <address@hidden>
> Date: Tue, 3 Jul 2018 13:14:29 -0700
> 
> Eli Zaretskii wrote:
> > Profiling shows that 'diag' takes 32% of the CPU time, and
> > buffer_chars_equal takes another 45%.  So any significant gains will
> > be in buffer_chars_equal, I think.
> 
> Yes, that was what my intuition was pointing at as well. Among other things, 
> we 
> can fix the quit problem without having a rbc_quitcounter variable.

Fix how?  Since the command can run for quite a few seconds, it is
imperative that we give the user the possibility to quit.  I
originally had maybe_quit there, but profiling showed that it used a
lot of CPU (because it accesses Lisp symbols, and was called for each
character 'diag' wanted to compare), so I switched to rarely_quit.
Last profile indicates rarely_quit takes about 6% of CPU time, which I
think is a reasonably low price to pay for responsiveness.

If you mean you have an idea for calling rarely_quit or its equivalent
in a more elegant way (e.g., without a static counter), then it would
be good, of course.  But I'm not sure that will speed up the code, and
we should be very careful not to slow it down just for QUIT's sake.

> I typically measure effectiveness of performance tweaks when using the 
> 'configure' default of CFLAGS='-g3 -O2', since that's how it's typically 
> built 
> downstream. If this particular problem is all about CFLAGS=-O0 please let me 
> know, as I guess I can look at that too (but would rather not).

Which particular problem were did you allude to?

I didn't (yet) profile the code in an optimized build, only in a -O0
build.  It could be that the optimized build will show a different
picture, although I doubt that.  I might try an optimized build in a
couple of days (but I never use -O3 in Emacs, only -O2).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]