[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: replace regex takes long
From: |
Gary Wessle |
Subject: |
Re: replace regex takes long |
Date: |
16 Apr 2006 21:53:06 +1000 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Eli Zaretskii <eliz@gnu.org> writes:
> > From: Gary Wessle <phddas@yahoo.com>
> > Date: 16 Apr 2006 09:35:00 +1000
> >
> > Gary Wessle <phddas@yahoo.com> writes:
> >
> > > Peter Dyballa <Peter_Dyballa@Web.DE> writes:
> > >
> > > > Am 15.04.2006 um 23:29 schrieb Gary Wessle:
> > > >
> > > > > M-x query-replace-regex <RET> +<RET><ONE SPACE>
> > > > > the file size is 4162111 with 77000 lines on PentiumIII 500, it has
> > > > > been 10 minutes so I opened another emacs processor to write and
> > > > > post this.
> > > > > is there a problem with my command and why it is taking that long?
> > > >
> > > > Yes, because the command needs your co-operation. And if you don't
> > > > press "yes" no change will be made.
> > >
> > > if fact I forget to say that I did hit ! which means "replace all"
> > with M-x regex-replace it shows (replaced 304172 occurrences) and it
> > is taking more than 5 minutes now and still have not finished the
> > task.
>
> I just tried query-replace-regex on a file with the structure you
> described, and the command ran to completion in just 40 seconds,
> including 3 questions whether to discard undo info. That was on a
> 3-GHz Pentium 4 in a buffer that is in Fundamental mode. So your
> timing seems very unusual, to say the least.
>
> Do you have some specialized major mode in that buffer? If so,
> perhaps it slows down the replacement; try in Fundamental mode. I'd
> also suggest to try the command in "emacs -q", perhaps something in
> your customizations slows down the replacements.
>
> In any case, your command is wasteful because it forces Emacs to
> replace even a single space. I suggest to try this instead:
>
> M-x query-replace-regex <RET> +<RET> <RET>
> ^^
> two spaces here
>
> This command takes just 20 seconds on my machine.
>
> Btw, what version of Emacs do you have, and on which OS?
I did it as you described,
#emacs -q
M-x query-replace-regex<RET> +<RET> <RET>
it took 24 sec. my OS is debian testing and
emacs version 21.4.1
thanks