emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inefficient code in xml.el


From: Kim F. Storm
Subject: Inefficient code in xml.el
Date: Mon, 06 Jun 2005 13:51:25 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

I noticed that xml.el has several occurences of code like this:

           ((looking-at (concat "<!ENTITY[ \t\n\r]*\\(" xml-name-re
                                "\\)[ \t\n\r]*\\(" xml-entity-value-re
                                "\\)[ \t\n\r]*>"))
            (let ((name  (buffer-substring (nth 2 (match-data))
                                           (nth 3 (match-data))))
                  (value (buffer-substring (+ (nth 4 (match-data)) 1)
                                           (- (nth 5 (match-data)) 1))))
              (goto-char (nth 1 (match-data)))


Using (match-data) like that is VERY, VERY inefficient.

Use either match-beginning/match-end, or match-string instead.


-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]