unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Gary Wessle <phddas@yahoo.com>
Subject: Re: replace regex takes long
Date: 16 Apr 2006 21:53:06 +1000	[thread overview]
Message-ID: <874q0tbuu5.fsf@localhost.localdomain> (raw)
In-Reply-To: mailman.473.1145168872.9609.help-gnu-emacs@gnu.org

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

  parent reply	other threads:[~2006-04-16 11:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-15 21:29 replace regex takes long Gary Wessle
2006-04-15 22:36 ` Peter Dyballa
     [not found] ` <mailman.456.1145140624.9609.help-gnu-emacs@gnu.org>
2006-04-15 23:09   ` Gary Wessle
2006-04-15 23:35     ` Gary Wessle
2006-04-16  6:27       ` Eli Zaretskii
2006-04-16 10:17       ` Peter Dyballa
2006-04-16 17:11         ` Eli Zaretskii
     [not found]       ` <mailman.473.1145168872.9609.help-gnu-emacs@gnu.org>
2006-04-16 11:53         ` Gary Wessle [this message]
2006-04-16 14:01       ` Stefan Monnier

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=874q0tbuu5.fsf@localhost.localdomain \
    --to=phddas@yahoo.com \
    /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.
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).