[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: latexenc-find-file-coding-system is slow.
From: |
Stefan Monnier |
Subject: |
Re: latexenc-find-file-coding-system is slow. |
Date: |
Fri, 29 Apr 2005 12:13:56 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) |
> re-search-forward("^[^%$]*\\usepackage\\[\\(.*\\)\\]{inputenc}" nil t)
^^
shouldn't this be \\\\ ?
> I guess the re-searching in latexenc-find-file-coding-system needs to
> be improved.
I see two obvious ways to speed it up:
- use (re-search-forward "\\\\usepackage\\[\\(.*\\)\\]{inputenc}")
and once it matched, check if it's inside a comment. This should be
*much* faster because of how the regexp-engine works (basically,
it will backtrack much less). The search as it is coded now could very
well fail with "regexp stack overflow".
- don't search through the whole buffer but only though the first part (10K
or so) of it.
> Since this change, opening a 117k .texi file takes seconds. It used
The filename regexp was broken, I've adjusted it so it doesn't get triggered
for .texi files.
Stefan