[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to circumvent warning in batch mode
From: |
Decebal |
Subject: |
Re: How to circumvent warning in batch mode |
Date: |
Sat, 10 Oct 2009 01:23:40 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Oct 9, 4:42 pm, Andreas Politz <poli...@fh-trier.de> wrote:
> I would suggest removing the body of the while-loop, in order to see if
> there is actually a significant amount of time spend there.
There the most time is spend. Without inner-loop it took 5 seconds.
Whithout the search for the regexp 3,5 seconds.
And without the write half a second.
The complete scripts takes 17,5 seconds.
When the inner loop only has the setq for match-length it takes 5,5
seconds.
When I also have the loop to increase substitute-str it takes 6,5
seconds.
The complete scripts takes 17,5 seconds.
When I change the code to:
(while (re-search-forward reg-exp nil t)
(replace-match substitute-str)
)
Then it takes 15 seconds.
So it looks like replace-match is very expensive. A candidate for
optimalisation?
> Depending on the file, a great deal goes probably into the
> initialization of the major-mode. Maybe you can use
> `find-file-literally' or some other means, I don't know.
I allready changed to:
(switch-to-buffer (find-file-noselect input-file t t))