From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Accelerating Emacs? Date: Fri, 28 Oct 2005 10:23:46 +0200 Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1130492084 25586 80.91.229.2 (28 Oct 2005 09:34:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 28 Oct 2005 09:34:44 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 28 11:34:42 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EVQcN-0003JR-HC for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Oct 2005 11:33:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EVQUX-0000vx-Cn for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Oct 2005 05:25:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EVPWh-0000k5-AO for help-gnu-emacs@gnu.org; Fri, 28 Oct 2005 04:23:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EVPWf-0000jc-Vc for help-gnu-emacs@gnu.org; Fri, 28 Oct 2005 04:23:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EVPWf-0000jY-MM for help-gnu-emacs@gnu.org; Fri, 28 Oct 2005 04:23:49 -0400 Original-Received: from [192.114.186.66] (helo=romy.inter.net.il) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EVPWf-0001Js-J8 for help-gnu-emacs@gnu.org; Fri, 28 Oct 2005 04:23:49 -0400 Original-Received: from HOME-C4E4A596F7 (IGLD-80-230-10-131.inter.net.il [80.230.10.131]) by romy.inter.net.il (MOS 3.5.8-GR) with ESMTP id CUZ18380 (AUTH halo1); Fri, 28 Oct 2005 10:23:41 +0200 (IST) Original-To: help-gnu-emacs@gnu.org In-reply-to: (herberteuler@hotmail.com) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:30645 Archived-At: > From: "Herbert Euler" > Date: Fri, 28 Oct 2005 13:53:08 +0800 > > >try fundamental-mode > > I tried that, but it is only effective when making small > changes i.e. deleting a character. Well, your original complaint _was_ about deleting a single character. Are you on the quest to prove at all costs that Emacs is slow? > On my test on a 8612 KB size file, Emacs is not quick enough > yet. The sed command > > sed 's/[A-Z]/0/g' test > > needs 17s to finish its job, and vim command > > :1,$:s/[A-Z]/0/g > > needs 1min 7s, but even 20min is still not enough for > the Emacs command (in fundamental-mode) > > (replace-regexp "[A-Z]" "0" nil nil nil) What kind of machine do you have there? I tried this on a 3MB file (my email inbox), and it took less than 1 minute, even though I needed to answer the question about discarding undo info several times during that time. This is on a 3GHz Pentium 4 running Windows XP. I then tried the same with a 19MB email box on a 700MHz Pentium III running Debian GNU/Linux, and it took 13 minutes there (vim did it in 30 seconds). Perhaps you should upgrade your hardware? Anyway, `replace-regexp' does much more than just replace its first argument with the second, and those other things make it run slower. The doc string for `replace-regexp' says (note the last part, especially): This function is usually the wrong thing to use in a Lisp program. What you probably want is a loop like this: (while (re-search-forward regexp nil t) (replace-match to-string nil nil)) which will run faster and will not set the mark or print anything. > Besides, Emacs uses about 128MB memory. ??? Not unless you visit many large files, it isn't. My Emacs session where I'm typing this runs for many days, has gobs of files and buffers in it, and still uses only 22MB of memory. > And when I tried to mark all text, Emacs complains about the memory. How much memory do you have on that machine (and what OS is that)? Also, please tell what command you used ``to mark all text'', and what was the exact language of the Emacs complaint about memory. > So I think it is better of using tools such as sed and > vim to edit file bigger than 5MB instead of Emacs, > since Emacs is not good at this job. You are entitled to decide whatever you wish, but this would be not a very wise decision, I think. It is based on an unrealistic example (perform unrealistic replacement in an unrealistic file). I'd advise against such a decision.