From: Lute Kamstra <Lute.Kamstra.lists@xs4all.nl>
Cc: emacs-devel@gnu.org
Subject: Re: latexenc-find-file-coding-system is slow.
Date: Fri, 29 Apr 2005 17:48:26 +0200 [thread overview]
Message-ID: <87is254m9h.fsf@xs4all.nl> (raw)
In-Reply-To: <874qdpaavu.fsf@arnested.dk> (Arne Jørgensen's message of "Fri, 29 Apr 2005 16:57:41 +0200")
Arne Jørgensen <arne@arnested.dk> writes:
> Lute Kamstra <Lute.Kamstra.lists@xs4all.nl> writes:
[...]
>> Since this change, opening a 117k .texi file takes seconds.
>
> First of all latexenc-find-file-coding-system shouldn't search .texi
> files. I just tested it and in my emacs it is not called on .texi
> files, but there could be something wrong with the entry in
> file-coding-system-alist:
>
> ("\\.tex\\|\\.ltx\\|\\.dtx\\|\\.drv\\'" . latexenc-find-file-coding-system)
>
> Does that entry match .texi files?
Yup, you probably mean "\\.\\(tex\\|ltx\\|dtx\\|drv\\)\\'". I'll fix that.
> Secondly the problem will of course still be there on large .tex files
> etc. which latexenc-find-file-coding-system is supposed search. See
> below.
>
> But my guess is .tex files normally doesn't grow as large as .texi
> files. YMMV.
My LaTeX files are typically 100k, sometimes even 200k.
>> It used to take a fraction of a second. I did a debug-on-quit
>> during the wait a couple of times and that consistently gave me one
>> of these two backtraces:
>
> [...]
>
>> I guess the re-searching in latexenc-find-file-coding-system needs to
>> be improved.
>
> latexenc-find-file-coding-system re-searches all of the files for an
> \inputencoding{...} command and if none is found it re-searches all of
> the file for an \usepackage[...]{inputenc} command.
>
> The two re-search-forward's could of course be limited to only search
> the first n positions of the buffer. The problem is though to find
> decent defaults for these limits.
>
> It would be possible to introduce some variables for these limits and
> let people customize them for their individual needs/tastes.
That seems like a good approach.
There is no need to search beyond a \begin{document}, is it? Maybe
that can be used as well: first search the first N characters for
\begin{document} and then search backward for \inputencoding{...} and
\usepackage[...]{inputenc}. You probably have to test this on a
number of files to see if it really helps.
Would you like to work on this?
Another idea is to change the regexps and search only for
\inputencoding{...} and \usepackage[...]{inputenc} at the start of a
line. That's where they typically are. This will speed up the search
dramatically. If you agree with it, I'll apply this fix for now.
Lute.
next prev parent reply other threads:[~2005-04-29 15:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1D7MTJ-0002Jj-BJ@fencepost.gnu.org>
2005-04-26 12:07 ` Your Emacs changes Arne Jørgensen
2005-04-28 11:58 ` Thien-Thi Nguyen
2005-04-29 12:11 ` latexenc-find-file-coding-system is slow. (was: Your Emacs changes) Lute Kamstra
2005-04-29 14:57 ` latexenc-find-file-coding-system is slow Arne Jørgensen
2005-04-29 15:48 ` Lute Kamstra [this message]
2005-04-29 16:13 ` Stefan Monnier
[not found] ` <877jil8rz5.fsf@arnested.dk>
2005-04-29 17:19 ` Lute Kamstra
2005-04-30 8:08 ` David Kastrup
2005-05-01 11:08 ` Lute Kamstra
2005-05-01 12:07 ` latexenc-find-file-coding-system is slow. (was: Your Emacs changes) Richard Stallman
[not found] ` <871x8m96p6.fsf@arnested.dk>
2005-05-11 11:48 ` latexenc-find-file-coding-system is slow Lute Kamstra
2005-05-11 17:21 ` Arne Jørgensen
2005-05-11 23:07 ` Lute Kamstra
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87is254m9h.fsf@xs4all.nl \
--to=lute.kamstra.lists@xs4all.nl \
--cc=emacs-devel@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).