From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Florian Weimer Newsgroups: gmane.emacs.devel Subject: Re: Removal of unexec support from glibc malloc Date: Tue, 19 Jan 2016 08:03:16 +0100 Message-ID: <569DDFB4.2080301@redhat.com> References: <569CDB81.6040600@redhat.com> <569D6B1E.6020002@emvision.com> <569D8E0B.1010603@yandex.ru> <1F560A56-37A2-482D-9010-8733E906FD16@raeburn.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070206030407040306090909" X-Trace: ger.gmane.org 1453187018 16261 80.91.229.3 (19 Jan 2016 07:03:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Jan 2016 07:03:38 +0000 (UTC) Cc: Ali Bahrami , emacs-devel@gnu.org To: Ken Raeburn , Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 19 08:03:38 2016 Return-path: Envelope-to: ged-emacs-devel@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 1aLQKH-000113-N5 for ged-emacs-devel@m.gmane.org; Tue, 19 Jan 2016 08:03:37 +0100 Original-Received: from localhost ([::1]:35322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLQKG-00018I-LA for ged-emacs-devel@m.gmane.org; Tue, 19 Jan 2016 02:03:36 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLQK4-000187-13 for emacs-devel@gnu.org; Tue, 19 Jan 2016 02:03:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLQK0-000335-QP for emacs-devel@gnu.org; Tue, 19 Jan 2016 02:03:23 -0500 Original-Received: from mx1.redhat.com ([209.132.183.28]:32839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLQK0-000331-Je for emacs-devel@gnu.org; Tue, 19 Jan 2016 02:03:20 -0500 Original-Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 831638D3B5; Tue, 19 Jan 2016 07:03:19 +0000 (UTC) Original-Received: from oldenburg.str.redhat.com (ovpn-204-31.brq.redhat.com [10.40.204.31]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0J73GaF030555 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Jan 2016 02:03:18 -0500 X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 In-Reply-To: <1F560A56-37A2-482D-9010-8733E906FD16@raeburn.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198342 Archived-At: This is a multi-part message in MIME format. --------------070206030407040306090909 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 01/19/2016 02:44 AM, Ken Raeburn wrote: >=20 >> On Jan 18, 2016, at 20:14, Dmitry Gutov wrote: >> >> On 01/19/2016 01:45 AM, Ali Bahrami wrote: >> >>> Before you fight to to save unexec, I'd encourage you to measure the >>> impact, and see if it still matters. >> >> As a rough measurement, 'src/emacs -Q' takes ~0.5s to launch on my mac= hine. 'src/temacs -Q` takes ~5.5s. >> >> It seems not only machines have become faster, Emacs has grown quite a= bit, too. :) >=20 > It=92s also pretty aggressive about garbage collection after loading an= y code before the unexec. Presumably that=92s to minimize the storage ne= eded for the shared on-disk image. >=20 > Try removing the after-load-functions hook in loadup.el that invokes GC= , and the explicit GC calls. Also maybe bump up gc-cons-threshold by an = order of magnitude. (Just until loading finishes, if you like.) The attached patch brings down the temacs load time to under 0.5 seconds. The major offender is find_string_data_in_pure in src/alloc.c, and setting purify to nil gets rid of that. Some additional savings come from removing the after-load-function hook in loadup.el, as you suggested, but they are comparatively minor. For some reason, international/characters does not load anymore, so I dropped it for quick testing. Florian --------------070206030407040306090909 Content-Type: text/x-patch; name="fast-temacs.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="fast-temacs.patch" diff --git a/lisp/loadup.el b/lisp/loadup.el index 5f29c01..8870eb7 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -47,6 +47,8 @@ =20 ;;; Code: =20 +(setq purify-flag nil) + ;; Add subdirectories to the load-path for files that might get ;; autoloaded when bootstrapping. ;; This is because PATH_DUMPLOADSEARCH is just "../lisp". @@ -99,10 +101,6 @@ (load "emacs-lisp/backquote") (load "subr") =20 -;; Do it after subr, since both after-load-functions and add-hook are -;; implemented in subr.el. -(add-hook 'after-load-functions (lambda (f) (garbage-collect))) - (load "version") =20 (load "widget") @@ -168,7 +166,6 @@ ;; This file doesn't exist when building a development version of Emacs ;; from the repository. It is generated just after temacs is built. (load "international/charprop.el" t) -(load "international/characters") (load "composite") =20 ;; Load language-specific files. @@ -374,11 +371,6 @@ ;; Avoid storing references to build directory in the binary. (setq custom-current-group-alist nil) =20 -;; We keep the load-history data in PURE space. -;; Make sure that the spine of the list is not in pure space because it = can -;; be destructively mutated in lread.c:build_load_history. -(setq load-history (mapcar 'purecopy load-history)) - (set-buffer-modified-p nil) =20 (remove-hook 'after-load-functions (lambda (f) (garbage-collect))) @@ -413,10 +405,6 @@ (message "Pure-hashed: %d strings, %d vectors, %d conses, %d bytecod= es, %d others" strings vectors conses bytecodes others))) =20 -;; Avoid error if user loads some more libraries now and make sure the -;; hash-consing hash table is GC'd. -(setq purify-flag nil) - (if (null (garbage-collect)) (setq pure-space-overflow t)) =20 --------------070206030407040306090909--