GNU bug report logs - #33887
26.1; Emacs hangs for several seconds when going to the end of an XML file in nXML mode

Previous Next

Package: emacs;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Thu, 27 Dec 2018 10:14:02 UTC

Severity: normal

Tags: fixed

Merged with 25176

Found in versions 26.0.50, 26.1

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Vincent Lefevre <vincent <at> vinc17.net>, 33887 <at> debbugs.gnu.org
Subject: bug#33887: 26.1; Emacs hangs for several seconds when going to the end of an XML file in nXML mode
Date: Thu, 17 Jan 2019 17:57:07 -0500
> The profile (see below) blames syntax-ppss called by
> sgml-syntax-propertize, so I suspect commit 0055190, which added
> sgml-syntax-propertize-inside to sgml-syntax-propertize.

Hmm... actually, the syntax-ppss calls that take time are directly made
from within sgml-syntax-propertize rather than from within
sgml-syntax-propertize-inside (which doesn't even appear in your profile
(in my profile I get 8099 units of time in sgml-syntax-propertize, of
which 7611 in syntax-ppss and only 77 in sgml-syntax-propertize-inside).
The problem seems to come from the following syntax propertize rule:

     ;; Double quotes outside of tags should not introduce strings.
     ;; Be careful to call `syntax-ppss' on a position before the one we're
     ;; going to change, so as not to need to flush the data we just computed.
     ("\"" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0))))
                    (goto-char (match-end 0)))
                  (string-to-syntax "."))))

If I comment it out, the delay is *much* smaller.

The problem being that " are quite common characters in XML files, so
the regexp matches often and we call syntax-ppss each time, so we end up
calling syntax-ppss very often.

I'm trying to figure out how to avoid calling syntax-ppss for every
" character.  I'm thinking of looking at pairs of " chars and only do
extra work if there's a < or > between the two.


        Stefan




This bug report was last modified 5 years and 353 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.