From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: Accelerating Emacs? Date: Fri, 28 Oct 2005 14:08:29 +0200 Organization: Organization?!? Message-ID: <85y84dkfnm.fsf@lola.goethe.zz> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1130503651 29588 80.91.229.2 (28 Oct 2005 12:47:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 28 Oct 2005 12:47:31 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 28 14:47:24 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EVTdf-0001DL-GC for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Oct 2005 14:47:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EVTde-0000AB-Om for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Oct 2005 08:47:18 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!newsfeed.arcor.de!news.arcor.de!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:S/jM3yubUYFyeUjWFgl10G1xdQU= Original-Lines: 47 Original-NNTP-Posting-Date: 28 Oct 2005 14:08:29 MEST Original-NNTP-Posting-Host: 784af39f.newsread4.arcor-online.net Original-X-Trace: DXC=kQcG>Zb@LVH[T26?78J:ejgIfPPldDjW\KbG]kaMHU7^]5?JhlBNhNLXQ; K2<9I1_LiI6ENVaM3>5MOK` 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:30652 Archived-At: "Herbert Euler" writes: >>From: Eli Zaretskii >>To: help-gnu-emacs@gnu.org >>Subject: Re: Accelerating Emacs? >>Date: Fri, 28 Oct 2005 10:23:46 +0200 > > Now I must show what I did. First, I wrote a Lisp program to generate > random data: > > (let ((i 0)) > (while (< i 20000) > (let ((j 0) s) > (while (< j 10) > (setq s (concat s (char-to-string (+ 50 (random 50)))) > j (1+ j))) > (insert s "\n")) > (setq i (1+ i)))) This is not good in any programming language, as it has quadratic time behavior. _Buffers_ are the data structures for inserting text, not strings. So you better write: (dotimes (i 20000) (dotimes (j 10) (insert-char (+ 50 (random 50)))) (insert-char ?\C-j)) > I found Emacs used more and more memory when generating random data, > so did when it replacing. These memory is released after Emacs > finishes its job. Is this because Emacs operating buffer residing in > memory? No, it is because of nonsensical accumulation of strings which are only garbage-collected from time to time. > This happens when I am testing a 100MB size file. I go to the beginning > of the file, press C-SPACE, then go to the end of the file, press M-w. Don't do that, then. Use delete-region instead of kill-region, or the region will end up in the kill ring, where it still occupies memory. And you might want to disable the undo history as well. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum