emacs-devel
[Top][All Lists]
Advanced

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

Re: Inefficient code in reftex-index.el


From: David Kastrup
Subject: Re: Inefficient code in reftex-index.el
Date: Mon, 06 Jun 2005 14:39:04 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

address@hidden (Kim F. Storm) writes:

> I noticed the following code in reftex-index.el:
>
>                     (condition-case nil (texmathp) (error nil))))
>             (setq beg (car (match-data))
>                   end (nth 1 (match-data)))
>
> Using match-data like that seems inefficient.
>
> I suggtest using match-beginning/match-end instead.

That is not the same: the above will set beg and end to markers,
whereas match-beginning/match-end happen to be integers.  However, the
above will also create markers that are unused, so it would be saner
to call (match-data) only once _if_ indeed markers are what is
required.

Unused markers slow done editing operations afterwards.  So even if
markers _are_ what is wanted for some reason, they should be
explicitly unseated with set-marker once they are no longer needed.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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