all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ivan Oreshnikov <oreshnikov.ivan@gmail.com>
Cc: 39598@debbugs.gnu.org
Subject: bug#39598: 26.3; Emacs is extremely unresponsive on a trivial python file
Date: Sat, 15 Feb 2020 10:05:27 +0200	[thread overview]
Message-ID: <83h7zsnum0.fsf@gnu.org> (raw)
In-Reply-To: <CAAjt43hJkwGBdp0XUd-JJahsue_oEMoiZyT2pVbkWf9Ly14hSA@mail.gmail.com> (message from Ivan Oreshnikov on Fri, 14 Feb 2020 17:31:48 +0100)

> From: Ivan Oreshnikov <oreshnikov.ivan@gmail.com>
> Date: Fri, 14 Feb 2020 17:31:48 +0100
> Cc: 39598@debbugs.gnu.org
> 
> Ok, here's the full expansion of the relevant part of the profiler report:

Looks like this part of python-nav--forward-sexp needs some
optimizations:

       (t
        ;; This part handles the lispy feel of
        ;; `python-nav-forward-sexp'.  Knowing everything about the
        ;; current context and the context of the next sexp tries to
        ;; follow the lisp sexp motion commands in a symmetric manner.
        (let* ((context
                (cond
                 ((python-info-beginning-of-block-p) 'block-start)
                 ((python-info-end-of-block-p) 'block-end)
                 ((python-info-beginning-of-statement-p) 'statement-start)
                 ((python-info-end-of-statement-p) 'statement-end)))
               (next-sexp-pos
                (save-excursion
                  (if safe
                      (python-nav--lisp-forward-sexp-safe dir)
                    (python-nav--lisp-forward-sexp dir))
                  (point)))
               (next-sexp-context
                (save-excursion
                  (goto-char next-sexp-pos)
                  (cond
                   ((python-info-beginning-of-block-p) 'block-start)
                   ((python-info-end-of-block-p) 'block-end)
                   ((python-info-beginning-of-statement-p) 'statement-start)
                   ((python-info-end-of-statement-p) 'statement-end)
                   ((python-info-statement-starts-block-p) 'starts-block)
                   ((python-info-statement-ends-block-p) 'ends-block)))))

For starters, it does a lot of processing to compute next-sexp-context
whose result is needed only in a couple of cases thereafter.  So maybe
avoiding some of that when not needed would help.

What is/are the real-life use case(s) where such long series of
strings causes slowdown?





  reply	other threads:[~2020-02-15  8:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 10:48 bug#39598: 26.3; Emacs is extremely unresponsive on a trivial python file Ivan Oreshnikov
2020-02-14 13:35 ` Eli Zaretskii
2020-02-14 13:50   ` Eli Zaretskii
2020-02-14 16:08     ` Ivan Oreshnikov
2020-02-14 16:17       ` Eli Zaretskii
2020-02-14 16:31         ` Ivan Oreshnikov
2020-02-15  8:05           ` Eli Zaretskii [this message]
2020-02-15 18:49             ` Ivan Oreshnikov
2020-02-15 19:22               ` Eli Zaretskii
2020-02-15 19:31                 ` Ivan Oreshnikov
2020-03-13  3:00             ` Noam Postavsky
2020-09-20  8:47               ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83h7zsnum0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=39598@debbugs.gnu.org \
    --cc=oreshnikov.ivan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.