From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hongxu Chen Newsgroups: gmane.emacs.help Subject: Re: Speeding up Emacs load time Date: Wed, 26 Jun 2013 10:02:53 +0800 Message-ID: <87d2r9d3xu.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1372212200 24539 80.91.229.3 (26 Jun 2013 02:03:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Jun 2013 02:03:20 +0000 (UTC) Cc: Emacs Help To: Andrew Pennebaker Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 26 04:03:17 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Urf4k-0001Mm-RY for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Jun 2013 04:03:14 +0200 Original-Received: from localhost ([::1]:34644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Urf4k-0000uQ-Fh for geh-help-gnu-emacs@m.gmane.org; Tue, 25 Jun 2013 22:03:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Urf4Y-0000uL-Iq for help-gnu-emacs@gnu.org; Tue, 25 Jun 2013 22:03:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Urf4V-0005Je-TK for help-gnu-emacs@gnu.org; Tue, 25 Jun 2013 22:03:02 -0400 Original-Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]:34472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Urf4V-0005Ja-N0 for help-gnu-emacs@gnu.org; Tue, 25 Jun 2013 22:02:59 -0400 Original-Received: by mail-pa0-f49.google.com with SMTP id ld11so13536315pab.36 for ; Tue, 25 Jun 2013 19:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=CAOcyEzt2VLMboiowdmnRafDiJ/Pk2qDU5zXcyuQb7w=; b=bW09YA6tpCump6OdKlsZwbHk2D8ck7xwYCsQjppVBZfaQLt1LyLoxYfX89DeGgNsIU fxSaOCUFvCU9CVIldMCc3dOt0jPDWRdHuzd0s/MK/T9leSx7w+Gq7hyS2Ng8+qSG7r0Q G8r9EB9AJdbi5cM5JoMHO39iMD6fYNpCBkDmmGjUZPri4EZyIIKtAlr+7wNgKfUzIJrO pk+H4aRq7NK2htpNpgOP+q91c3n5bjKGzI0ll9WDheHc5dkStC2e3CcpmH0mM1xXpfvC QW3cGVGNUNMCiI+UOG7r+CqpCT/8EXZqdbFVw4Yr8FQ07ZWEOYG/xzjzcjh2MpSsJvjE waCg== X-Received: by 10.66.166.232 with SMTP id zj8mr2384380pab.139.1372212178473; Tue, 25 Jun 2013 19:02:58 -0700 (PDT) Original-Received: from hongxuchen-VM.STAP ([167.220.232.198]) by mx.google.com with ESMTPSA id yj2sm25640765pbb.40.2013.06.25.19.02.56 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 25 Jun 2013 19:02:57 -0700 (PDT) In-Reply-To: (Andrew Pennebaker's message of "Tue, 25 Jun 2013 19:06:29 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::231 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91722 Archived-At: Andrew Pennebaker writes: > I love Emacs's customizability! I regularly edit my .emacs file, and the > community has been helpful and encouraging. But I do notice that Emacs can > take several (10) seconds or longer to load. It's odd that with so many "add-hook" and "autoload" the startup time is still not that short. I guess you need a load time profiler like `ProfileDotEmacs'(http://www.emacswiki.org/emacs/ProfileDotEmacs) and find out what eats up the time. > > For reference, I'm using Emacs 24.1 for Mac OS X, Windows, and Android. I > keep my .emacs synced, shared, and backed up on GitHub. > https://github.com/mcandre/dotfiles/blob/master/.emacs > > Could someone help me cut down the load time while maintaining the same > behavior? Some advice: 1. use compiled elisp(elc), however there seems no problem since you are using `package', who does compile the script files he manages. 2. try separate some of the script(those you won't need until you use the feature) from ~/.emacs(or ~/.init.el) and put them into special files and try to use more "eval-after-load", "autoload", "add-hook"(be careful for the buffer-local/global variable settings and choose the right function of the three) 3. add (server-start) at the end of ~/.emacs and run emacsclient next time you need emacs. For my understanding, running `emacsclient -t -a ""' at the beginning would slow down the startup time for the first time. 4. It's not a problem when the startup time is not satisfactory since you only need to open emacs once and you stay in it until you shutdown your computer(IIRR, there is a midnight script support that there is no need at all to close Emacs at all since it would do the cleanup work automatically). -- Regards, Hongxu Chen