Subject: Re: bug#59641: term is very slow

From: Eli Zaretskii <[email-masked]>
Date: Fri, 16 Dec 2022 20:57:41 +0200

> From: Akib Azmain Turja <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 17 Dec 2022 00:29:02 +0600
> 
> >> Here are the reports (attached), but don't seem to be human readable:
> >
> > Copy them from the display shown by profiler-report, after you expand it
> > completely.
> >
> > And the "cpu" profile is enough; the "mem" one doesn't add anything useful.
> 
> Sorry, I missed this reply.  I found this in debbugs.gnu.org.  :O
> 
> Here is the data:  (I didn't redo the steps, I just did
> 'M-x profiler-find-profile RET path/to/profile'.  ;)  )
> 
> --8<---------------cut here---------------start------------->8---
>         9397  95% - term-emulate-terminal
>         2710  27%  - term-handle-ansi-escape
>         1831  18%   - term-down
>            8   0%      term-move-columns
>          765   7%   - term-goto

Doesn't surprise me: most of the time is spent in term.el's business
logic, not in Emacs display primitives.

If you want to work on speeding up term.el, I suggest to start by
loading term.el (not term.elc) manually, and repeating the profiling
session.  That could tell you in more detail where are the hot sports
in those functions at the top of the profile.  Then some clever
optimization ideas are needed to make it significantly faster.

Thanks.