[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
query-replace-regexp slow for evaluated lisp expressions
From: |
Aaron S. Hawley |
Subject: |
query-replace-regexp slow for evaluated lisp expressions |
Date: |
Wed, 03 Jan 2007 09:39:47 -0500 |
User-agent: |
Internet Messaging Program (IMP) H3 (4.1.3) |
Search and evaluated replace expressions with `query-replace-regexp'
are a bit slow and do not scale well to large files, even with the
simplest of lisp expressions, in particular when using automatic
replace of all matches by hitting "!"?
For instance, create a buffer `foo' with 200 lines of "foo":
C-x b foo RET
C-x ( foo RET C-x )
C-u 200 C-x e
Then, do the most basic of replacements that would never be done in
practice, but shows how slow interactive regexp replacements can be:
Search for "foo" and just format the complete match as a string with a
lisp expression, and type "!" to do it to all of them:
M-< C-M-% foo RET \,(format "%s" \&) RET !
Compare this with:
M-< C-M-% foo RET foo RET !
Much quicker. The former "animates" each replacement showing it being
done, almost as if Emacs is hitting "y" interactively for me, rather
than just zooming through them all, as the latter does.
Thanks for Emacs.
/a
If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
`bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/Applications/Emacs/Emacs.app/Contents/Resources/etc/DEBUG for instructions.
In GNU Emacs 23.0.0.1 (powerpc-apple-darwin8.8.0, *Step 9.0-rc1)
of 2006-12-24 on yesod.local
configured using `configure '--with-ns' '--without-x'
'--prefix=/Users/arobert/src/EmacsApp/emacs/nextstep/build/Emacs.app/Contents/Resources' '--exec_prefix=/Users/arobert/src/EmacsApp/emacs/nextstep/build/Emacs.app/Contents/MacOS' '--libexecdir=/Users/arobert/src/EmacsApp/emacs/nextstep/build/Emacs.app/Contents/MacOS/libexec' '--with-pop' '--enable-font-backend' 'CC=gcc-4.0' 'CFLAGS=-g -O2 -arch ppc -arch i386 -isysroot
/Developer/SDKs/MacOSX10.4u.sdk''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: nil
value of $XMODIFIERS: nil
locale-coding-system: nil
default-enable-multibyte-characters: t
Major mode: Lisp Interaction
Minor modes in effect:
delete-selection-mode: t
tooltip-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
global-auto-composition-mode: t
auto-composition-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
M-% f o o <return> ! M-< M-< C-M-s M-p <return> M-%
M-p M-p C-k \ & <return> ! <M-tab> C-x b * s c <tab>
<return> C-n C-n C-n C-n C-k C-_ <help-echo> C-x b
C-g C-g C-x b C-g C-g C-x C-b C-x o C-n C-n C-n C-p
<return> <help-echo> M-< C-v M-< C-g C-g C-x o C-n
C-k r e p o <tab> r <tab> <return>
Recent messages:
complete-tag: No tags table loaded; try M-x visit-tags-table
Undo!
Quit [4 times]
Mark set [2 times]
Quit [2 times]
Mark set
Making completion list... [2 times]
Loading emacsbug...
Loading regexp-opt...done
Loading emacsbug...done
- query-replace-regexp slow for evaluated lisp expressions,
Aaron S. Hawley <=