When working with an iESS session of R and an R file open side-by-side, I noticed extremely slow performance when typing indetifiers. Typing braces and operators is fine, however, when an identifier is typed, there is very significant input lag (typed letters are appearing several second late). During this period, the the status of the iESS buffer flashes between run and no process. This happens most often when I am typing inside a function argument list and with a subordinate R process that consumes a sizeable chunk of memory (around 3G, a couple of big data frames and sparse matrices).

I have disabled eldoc-mode and company-mode, but ESS still seems to do something to the background R process synchronously.

What causes this? How can I profile ESS to find out how it spends time communicating with R?

I tried profiler-start and its friends, which show that Emacs spends 45% of its time in term-emulate-terminal (I ran htop in an ansi-term buffer to see the CPU usage of emacs and R) and 16% in the Automatic GC. That's hardly suspicious. I guess the time spent waiting for the subordinate process is considered idle time by the profiler.

  • Notably, you're interested in strategies for solving similar problems yourself... not just another "gimme the code that fixes this!" type question. +1
    – PythonNut
    Feb 26, 2015 at 22:39
  • Yeah, I would be also interested in techniques for tracing/profiling process filters in general... According to my (very little) experience, they are a real pain to write and debug. :-) Feb 26, 2015 at 22:43
  • 1
    I would just start emacs -q then evaluate just those part of your init file that sets up ESS. If the behavior is observed there I would file a bug report. If not, keep loading sections of your init file until you find the part responsible for your problem. Also, you may want to state which versions of Emacs and ESS you are running.
    – Ista
    Feb 27, 2015 at 3:09
  • 1
    I think the "flashes between run and no process" is an indication of a bug (maybe something causes the process to die and be repeatedly re-started?). Have you reported this to the ESS maintainer(s)? One more thing: try M-x load-library RET term.el RET (i.e. load the uncompiled version of term.el) and then redo the profiling: it might give you a more detailed profile.
    – Stefan
    Apr 2, 2015 at 12:49
  • Did you ever determine the source of the problem? My ESS buffer also hangs all the time. Jan 13, 2020 at 14:26

2 Answers 2


I know this is 5, almost 6, years late. The last response is from January of this year though.

There's been a recent development that might solve the issue for people in the future.

It turns out that the contextual help at the bottom in the minibuffer that appears when you're getting autocomplete is massively inefficient. This seems to be an isolated issue when company-mode is on. The current "fix" is a flag someone put into a very recent version of ESS.

You can enable it by setting (setq ess-r--no-company-meta t).

You'll still get completion from company-mode. The only difference is that the sometimes helpful, sometimes not, line in the minibuffer that will say plot(x, y, main="", etc., ...) will not appear.

See the discussion on GitHub.


Try turning off these:

(setq ess-use-flymake nil)
(setq ess-eval-visibly-p nil)

Flymake is on by default. Turning it off can speed things up. Also long lines in ess-eval-visibly-p can slow or stall emacs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.