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.