* bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
@ 2009-08-29 18:41 ` Dan Nicolaescu
2009-08-29 21:34 ` Stefan Monnier
2009-09-17 6:25 ` bug#4287: marked as done (reducing emacs size by more frequent garbage-collect calls in loadup.el) Emacs bug Tracking System
0 siblings, 2 replies; 15+ messages in thread
From: Dan Nicolaescu @ 2009-08-29 18:41 UTC (permalink / raw
To: bug-gnu-emacs
As the Subject says, replacing each `load' line in loadup.el with
`load' + `garbage-collect' will reduce the size of the stripped emacs
binary: (.7 is before, .8 is after the change)
$ ls -l emacs-23.1.50.8 emacs-23.1.50.7
-rwx------ 1 dann dann 6722788 Jul 24 14:20 emacs-23.1.50.8*
-rwx------ 1 dann dann 6857956 Jul 24 14:20 emacs-23.1.50.7*
$ size emacs-23.1.50.8 emacs-23.1.50.7
text data bss dec hex filename
1883659 4833256 0 6716915 667df3 emacs-23.1.50.8
1883659 4968424 0 6852083 688df3 emacs-23.1.50.7
so we get about 2% reduction by doing something very simple and safe...
[This happens because loading multiple files generate more garbage that
can be collected, but it is not returned to the OS, so it appears in
the dumped image].
See the discussion on this topic on emacs-devel:
http://permalink.gmane.org/gmane.emacs.devel/113176
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
2009-08-29 18:41 ` bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el Dan Nicolaescu
@ 2009-08-29 21:34 ` Stefan Monnier
2009-08-30 6:09 ` Dan Nicolaescu
2009-09-17 6:25 ` bug#4287: marked as done (reducing emacs size by more frequent garbage-collect calls in loadup.el) Emacs bug Tracking System
1 sibling, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2009-08-29 21:34 UTC (permalink / raw
To: Dan Nicolaescu; +Cc: 4287, bug-gnu-emacs
> As the Subject says, replacing each `load' line in loadup.el with
> `load' + `garbage-collect' will reduce the size of the stripped emacs
> binary: (.7 is before, .8 is after the change)
> $ ls -l emacs-23.1.50.8 emacs-23.1.50.7
> -rwx------ 1 dann dann 6722788 Jul 24 14:20 emacs-23.1.50.8*
> -rwx------ 1 dann dann 6857956 Jul 24 14:20 emacs-23.1.50.7*
> $ size emacs-23.1.50.8 emacs-23.1.50.7
> text data bss dec hex filename
> 1883659 4833256 0 6716915 667df3 emacs-23.1.50.8
> 1883659 4968424 0 6852083 688df3 emacs-23.1.50.7
> so we get about 2% reduction by doing something very simple and safe...
> [This happens because loading multiple files generate more garbage that
> can be collected, but it is not returned to the OS, so it appears in
> the dumped image].
> See the discussion on this topic on emacs-devel:
> http://permalink.gmane.org/gmane.emacs.devel/113176
Can you show the patch?
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
2009-08-29 21:34 ` Stefan Monnier
@ 2009-08-30 6:09 ` Dan Nicolaescu
2009-08-30 18:00 ` Eli Zaretskii
2009-08-30 20:04 ` Stefan Monnier
0 siblings, 2 replies; 15+ messages in thread
From: Dan Nicolaescu @ 2009-08-30 6:09 UTC (permalink / raw
To: Stefan Monnier; +Cc: 4287
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> > As the Subject says, replacing each `load' line in loadup.el with
> > `load' + `garbage-collect' will reduce the size of the stripped emacs
> > binary: (.7 is before, .8 is after the change)
>
> > $ ls -l emacs-23.1.50.8 emacs-23.1.50.7
> > -rwx------ 1 dann dann 6722788 Jul 24 14:20 emacs-23.1.50.8*
> > -rwx------ 1 dann dann 6857956 Jul 24 14:20 emacs-23.1.50.7*
>
> > $ size emacs-23.1.50.8 emacs-23.1.50.7
> > text data bss dec hex filename
> > 1883659 4833256 0 6716915 667df3 emacs-23.1.50.8
> > 1883659 4968424 0 6852083 688df3 emacs-23.1.50.7
>
> > so we get about 2% reduction by doing something very simple and safe...
>
> > [This happens because loading multiple files generate more garbage that
> > can be collected, but it is not returned to the OS, so it appears in
> > the dumped image].
>
> > See the discussion on this topic on emacs-devel:
> > http://permalink.gmane.org/gmane.emacs.devel/113176
>
> Can you show the patch?
Sure:
--- loadup.el.~1.180.~ 2009-08-20 23:31:53.000000000 -0700
+++ loadup.el 2009-08-29 23:02:34.000000000 -0700
@@ -57,30 +57,49 @@
(setq buffer-undo-list t)
(load "emacs-lisp/byte-run")
+(garbage-collect)
(load "emacs-lisp/backquote")
+(garbage-collect)
(load "subr")
+(garbage-collect)
;; We specify .el in case someone compiled version.el by mistake.
(load "version.el")
+(garbage-collect)
(load "widget")
+(garbage-collect)
(load "custom")
+(garbage-collect)
(load "emacs-lisp/map-ynp")
+(garbage-collect)
(load "cus-start")
+(garbage-collect)
(load "international/mule")
+(garbage-collect)
(load "international/mule-conf.el") ;Don't get confused if someone compiled this by mistake.
+(garbage-collect)
(load "env")
+(garbage-collect)
(load "format")
+(garbage-collect)
(load "bindings")
+(garbage-collect)
(setq load-source-file-function 'load-with-code-conversion)
(load "files")
+(garbage-collect)
(load "cus-face")
+(garbage-collect)
(load "faces") ; after here, `defface' may be used.
+(garbage-collect)
(load "minibuffer")
+(garbage-collect)
(load "button")
+(garbage-collect)
(load "startup")
+(garbage-collect)
(message "Lists of integers (garbage collection statistics) are normal output")
(message "while building Emacs; they do not indicate a problem.")
@@ -94,133 +113,220 @@
(message "%s" (garbage-collect))
(load "abbrev") ;lisp-mode.el and simple.el use define-abbrev-table.
+(garbage-collect)
(load "simple")
+(garbage-collect)
(load "help")
+(garbage-collect)
(load "jka-cmpr-hook")
+(garbage-collect)
(load "epa-hook")
+(garbage-collect)
;; Any Emacs Lisp source file (*.el) loaded here after can contain
;; multilingual text.
(load "international/mule-cmds")
+(garbage-collect)
(load "case-table")
+(garbage-collect)
(load "international/characters")
+(garbage-collect)
(load "composite")
+(garbage-collect)
;; This file doesn't exist when building Emacs from CVS. It is
;; generated just after temacs is build.
(load "international/charprop.el" t)
+(garbage-collect)
;; Load language-specific files.
(load "language/chinese")
+(garbage-collect)
(load "language/cyrillic")
+(garbage-collect)
(load "language/indian")
+(garbage-collect)
(load "language/sinhala")
+(garbage-collect)
(load "language/english")
+(garbage-collect)
(load "language/ethiopic")
+(garbage-collect)
(load "language/european")
+(garbage-collect)
(load "language/czech")
+(garbage-collect)
(load "language/slovak")
+(garbage-collect)
(load "language/romanian")
+(garbage-collect)
(load "language/greek")
+(garbage-collect)
(load "language/hebrew")
+(garbage-collect)
(load "language/japanese")
+(garbage-collect)
(load "language/korean")
+(garbage-collect)
(load "language/lao")
+(garbage-collect)
(load "language/tai-viet")
+(garbage-collect)
(load "language/thai")
+(garbage-collect)
(load "language/tibetan")
+(garbage-collect)
(load "language/vietnamese")
+(garbage-collect)
(load "language/misc-lang")
+(garbage-collect)
(load "language/utf-8-lang")
+(garbage-collect)
(load "language/georgian")
+(garbage-collect)
(load "language/khmer")
+(garbage-collect)
(load "language/burmese")
+(garbage-collect)
(load "language/cham")
+(garbage-collect)
(load "indent")
+(garbage-collect)
(load "window")
+(garbage-collect)
(load "frame")
+(garbage-collect)
(load "term/tty-colors")
+(garbage-collect)
(load "font-core")
+(garbage-collect)
;; facemenu must be loaded before font-lock, because `facemenu-keymap'
;; needs to be defined when font-lock is loaded.
(load "facemenu")
+(garbage-collect)
(load "emacs-lisp/syntax")
+(garbage-collect)
(load "font-lock")
+(garbage-collect)
(load "jit-lock")
+(garbage-collect)
(if (fboundp 'track-mouse)
(progn
(load "mouse")
+ (garbage-collect)
(and (boundp 'x-toolkit-scroll-bars)
- (load "scroll-bar"))
- (load "select")))
+ (load "scroll-bar")
+ (garbage-collect))
+ (load "select")
+ (garbage-collect)))
(load "emacs-lisp/timer")
+(garbage-collect)
(load "isearch")
+(garbage-collect)
(load "rfn-eshadow")
+(garbage-collect)
(message "%s" (garbage-collect))
(load "menu-bar")
+(garbage-collect)
(load "paths.el") ;Don't get confused if someone compiled paths by mistake.
+(garbage-collect)
(load "emacs-lisp/lisp")
+(garbage-collect)
(load "textmodes/page")
+(garbage-collect)
(load "register")
+(garbage-collect)
(load "textmodes/paragraphs")
+(garbage-collect)
(load "emacs-lisp/lisp-mode")
+(garbage-collect)
(load "textmodes/text-mode")
+(garbage-collect)
(load "textmodes/fill")
(message "%s" (garbage-collect))
(load "replace")
+(garbage-collect)
(load "buff-menu")
+(garbage-collect)
(if (fboundp 'x-create-frame)
(progn
(load "fringe")
+ (garbage-collect)
(load "image")
+ (garbage-collect)
(load "international/fontset")
+ (garbage-collect)
(load "dnd")
+ (garbage-collect)
(load "mwheel")
- (load "tool-bar")))
+ (garbage-collect)
+ (load "tool-bar")
+ (garbage-collect)))
(if (featurep 'x)
(progn
(load "x-dnd")
+ (garbage-collect)
(load "term/common-win")
- (load "term/x-win")))
+ (garbage-collect)
+ (load "term/x-win")
+ (garbage-collect)))
(message "%s" (garbage-collect))
(if (eq system-type 'windows-nt)
(progn
(load "w32-vars")
+ (garbage-collect)
(load "term/common-win")
+ (garbage-collect)
(load "term/w32-win")
+ (garbage-collect)
(load "ls-lisp")
+ (garbage-collect)
(load "disp-table")
+ (garbage-collect)
(load "dos-w32")
- (load "w32-fns")))
+ (garbage-collect)
+ (load "w32-fns")
+ (garbage-collect)))
(if (eq system-type 'ms-dos)
(progn
(load "dos-w32")
+ (garbage-collect)
(load "dos-fns")
+ (garbage-collect)
(load "dos-vars")
+ (garbage-collect)
;; Don't load term/common-win: it isn't appropriate for the `pc'
;; ``window system'', which generally behaves like a terminal.
(load "term/pc-win")
+ (garbage-collect)
(load "ls-lisp")
- (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el
+ (garbage-collect)
+ (load "disp-table")
+ (garbage-collect))) ; needed to setup ibm-pc char set, see internal.el
(if (featurep 'ns)
(progn
(load "emacs-lisp/easymenu") ;; for platform-related menu adjustments
- (load "term/ns-win")))
+ (garbage-collect)
+ (load "term/ns-win")
+ (garbage-collect)))
(if (fboundp 'atan) ; preload some constants and
(progn ; floating pt. functions if we have float support.
- (load "emacs-lisp/float-sup")))
+ (load "emacs-lisp/float-sup")
+ (garbage-collect)))
(message "%s" (garbage-collect))
(load "vc-hooks")
+(garbage-collect)
(load "ediff-hook")
-(if (fboundp 'x-show-tip) (load "tooltip"))
+(garbage-collect)
+(if (fboundp 'x-show-tip) (progn (load "tooltip") (garbage-collect)))
(message "%s" (garbage-collect))
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
2009-08-30 6:09 ` Dan Nicolaescu
@ 2009-08-30 18:00 ` Eli Zaretskii
2009-08-30 20:04 ` Stefan Monnier
1 sibling, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2009-08-30 18:00 UTC (permalink / raw
To: Dan Nicolaescu; +Cc: 4287
> Date: Sat, 29 Aug 2009 23:09:10 -0700 (PDT)
> From: Dan Nicolaescu <dann@ics.uci.edu>
> Cc: 4287@emacsbugs.donarmstrong.com
>
> --- loadup.el.~1.180.~ 2009-08-20 23:31:53.000000000 -0700
> +++ loadup.el 2009-08-29 23:02:34.000000000 -0700
> @@ -57,30 +57,49 @@
> (setq buffer-undo-list t)
>
> (load "emacs-lisp/byte-run")
> +(garbage-collect)
> (load "emacs-lisp/backquote")
> +(garbage-collect)
> (load "subr")
> +(garbage-collect)
>
> ;; We specify .el in case someone compiled version.el by mistake.
> (load "version.el")
> +(garbage-collect)
Perhaps a new function `load-and-gc' would be a good idea.
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
2009-08-30 6:09 ` Dan Nicolaescu
2009-08-30 18:00 ` Eli Zaretskii
@ 2009-08-30 20:04 ` Stefan Monnier
2009-08-30 20:45 ` Juanma Barranquero
` (2 more replies)
1 sibling, 3 replies; 15+ messages in thread
From: Stefan Monnier @ 2009-08-30 20:04 UTC (permalink / raw
To: Dan Nicolaescu; +Cc: 4287
>> Can you show the patch?
> Sure:
Sorry, too ugly to be worth the few bytes (especially since these are
bytes you'll be using anyway as soon as you start Emacs).
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
2009-08-30 20:04 ` Stefan Monnier
@ 2009-08-30 20:45 ` Juanma Barranquero
2009-08-31 14:46 ` bug#4287: reducing emacs size by more frequent garbage-collect Stefan Monnier
2009-08-30 23:55 ` bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el Juri Linkov
2009-08-31 4:25 ` Dan Nicolaescu
2 siblings, 1 reply; 15+ messages in thread
From: Juanma Barranquero @ 2009-08-30 20:45 UTC (permalink / raw
To: Stefan Monnier; +Cc: 4287
On Sun, Aug 30, 2009 at 22:04, Stefan Monnier<monnier@iro.umontreal.ca> wrote:
> Sorry, too ugly to be worth the few bytes (especially since these are
> bytes you'll be using anyway as soon as you start Emacs).
I've often wondered why there is no `after-load-hook' or
`after-load-functions', run directly from (the end of) Fload. Then we
could do now
--- loadup.el 21 Aug 2009 06:19:28 -0000 1.180
+++ loadup.el 30 Aug 2009 20:44:10 -0000
@@ -57,4 +57,5 @@
(setq buffer-undo-list t)
+(add-hook 'after-load-hook 'garbage-collect)
(load "emacs-lisp/byte-run")
(load "emacs-lisp/backquote")
@@ -286,4 +287,5 @@
(load "site-init" t)
(setq current-load-list nil)
+(remove-hook 'after-load-hook 'garbage-collect)
;; Write the value of load-history into fns-VERSION.el,
which is not so easy or elegant with `after-load-alist' (whose
regexp-matching functionality is implemented in elisp, AFAICS).
Juanma
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
2009-08-30 20:04 ` Stefan Monnier
2009-08-30 20:45 ` Juanma Barranquero
@ 2009-08-30 23:55 ` Juri Linkov
2009-08-31 4:25 ` Dan Nicolaescu
2 siblings, 0 replies; 15+ messages in thread
From: Juri Linkov @ 2009-08-30 23:55 UTC (permalink / raw
To: Stefan Monnier; +Cc: 4287, Dan Nicolaescu
>>> Can you show the patch?
>> Sure:
>
> Sorry, too ugly to be worth the few bytes (especially since these are
> bytes you'll be using anyway as soon as you start Emacs).
Can't we set gc-cons-percentage or gc-cons-threshold to a lower value
in loadup.el to more frequent GC?
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
2009-08-30 20:04 ` Stefan Monnier
2009-08-30 20:45 ` Juanma Barranquero
2009-08-30 23:55 ` bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el Juri Linkov
@ 2009-08-31 4:25 ` Dan Nicolaescu
2009-08-31 14:49 ` Stefan Monnier
2 siblings, 1 reply; 15+ messages in thread
From: Dan Nicolaescu @ 2009-08-31 4:25 UTC (permalink / raw
To: Stefan Monnier; +Cc: 4287
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> >> Can you show the patch?
> > Sure:
>
> Sorry, too ugly to be worth the few bytes (especially since these are
> bytes you'll be using anyway as soon as you start Emacs).
How about another suggested method that is not ugly: a load-and-gc
function?
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect
2009-08-30 20:45 ` Juanma Barranquero
@ 2009-08-31 14:46 ` Stefan Monnier
2009-09-01 11:44 ` Juanma Barranquero
0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2009-08-31 14:46 UTC (permalink / raw
To: Juanma Barranquero; +Cc: 4287
>> Sorry, too ugly to be worth the few bytes (especially since these are
>> bytes you'll be using anyway as soon as you start Emacs).
> I've often wondered why there is no `after-load-hook' or
> `after-load-functions', run directly from (the end of) Fload. Then we
> could do now
We could replace the call from C to do-after-load-evaluation by
Frun_hooks(Qafter-load-functions), either passing it the file name
explicitly or making sure load-file-name is still set.
> which is not so easy or elegant with `after-load-alist' (whose
> regexp-matching functionality is implemented in elisp, AFAICS).
Doesn't something like (push '("" (garbage-collect)) after-load-alist)
do the trick? Oh I see it doesn't because we check purify-flag.
Clearly this check could be removed if we use after-load-functions.
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
2009-08-31 4:25 ` Dan Nicolaescu
@ 2009-08-31 14:49 ` Stefan Monnier
2009-09-01 0:57 ` Dan Nicolaescu
0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2009-08-31 14:49 UTC (permalink / raw
To: Dan Nicolaescu; +Cc: 4287
>> >> Can you show the patch?
>> > Sure:
>> Sorry, too ugly to be worth the few bytes (especially since these are
>> bytes you'll be using anyway as soon as you start Emacs).
> How about another suggested method that is not ugly: a load-and-gc
> function?
Could be. The devil is in the details, so without the patch it's hard
to judge.
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
2009-08-31 14:49 ` Stefan Monnier
@ 2009-09-01 0:57 ` Dan Nicolaescu
0 siblings, 0 replies; 15+ messages in thread
From: Dan Nicolaescu @ 2009-09-01 0:57 UTC (permalink / raw
To: Stefan Monnier; +Cc: 4287
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> >> >> Can you show the patch?
> >> > Sure:
> >> Sorry, too ugly to be worth the few bytes (especially since these are
> >> bytes you'll be using anyway as soon as you start Emacs).
> > How about another suggested method that is not ugly: a load-and-gc
> > function?
>
> Could be. The devil is in the details, so without the patch it's hard
> to judge.
Here's one.
The function name can be adjusted to be more specific if needed, and the
fmakunbound call is not necessarily needed...
--- loadup.el.~1.180.~ 2009-08-20 23:31:53.000000000 -0700
+++ loadup.el 2009-08-31 17:55:33.000000000 -0700
@@ -56,31 +56,35 @@
(set-buffer "*scratch*")
(setq buffer-undo-list t)
-(load "emacs-lisp/byte-run")
-(load "emacs-lisp/backquote")
-(load "subr")
+(defun load-and-gc (file &optional noerror nomessage nosuffix must-suffix)
+ (load file noerror nomessage nosuffix must-suffix)
+ (garbage-collect))
+
+(load-and-gc "emacs-lisp/byte-run")
+(load-and-gc "emacs-lisp/backquote")
+(load-and-gc "subr")
;; We specify .el in case someone compiled version.el by mistake.
-(load "version.el")
+(load-and-gc "version.el")
-(load "widget")
-(load "custom")
-(load "emacs-lisp/map-ynp")
-(load "cus-start")
-(load "international/mule")
-(load "international/mule-conf.el") ;Don't get confused if someone compiled this by mistake.
-(load "env")
-(load "format")
-(load "bindings")
+(load-and-gc "widget")
+(load-and-gc "custom")
+(load-and-gc "emacs-lisp/map-ynp")
+(load-and-gc "cus-start")
+(load-and-gc "international/mule")
+(load-and-gc "international/mule-conf.el") ;Don't get confused if someone compiled this by mistake.
+(load-and-gc "env")
+(load-and-gc "format")
+(load-and-gc "bindings")
(setq load-source-file-function 'load-with-code-conversion)
-(load "files")
+(load-and-gc "files")
-(load "cus-face")
-(load "faces") ; after here, `defface' may be used.
-(load "minibuffer")
+(load-and-gc "cus-face")
+(load-and-gc "faces") ; after here, `defface' may be used.
+(load-and-gc "minibuffer")
-(load "button")
-(load "startup")
+(load-and-gc "button")
+(load-and-gc "startup")
(message "Lists of integers (garbage collection statistics) are normal output")
(message "while building Emacs; they do not indicate a problem.")
@@ -88,139 +92,139 @@
(condition-case nil
;; Don't get confused if someone compiled this by mistake.
- (load "loaddefs.el")
+ (load-and-gc "loaddefs.el")
;; In case loaddefs hasn't been generated yet.
- (file-error (load "ldefs-boot.el")))
+ (file-error (load-and-gc "ldefs-boot.el")))
(message "%s" (garbage-collect))
-(load "abbrev") ;lisp-mode.el and simple.el use define-abbrev-table.
-(load "simple")
+(load-and-gc "abbrev") ;lisp-mode.el and simple.el use define-abbrev-table.
+(load-and-gc "simple")
-(load "help")
+(load-and-gc "help")
-(load "jka-cmpr-hook")
-(load "epa-hook")
+(load-and-gc "jka-cmpr-hook")
+(load-and-gc "epa-hook")
;; Any Emacs Lisp source file (*.el) loaded here after can contain
;; multilingual text.
-(load "international/mule-cmds")
-(load "case-table")
-(load "international/characters")
-(load "composite")
+(load-and-gc "international/mule-cmds")
+(load-and-gc "case-table")
+(load-and-gc "international/characters")
+(load-and-gc "composite")
;; This file doesn't exist when building Emacs from CVS. It is
;; generated just after temacs is build.
-(load "international/charprop.el" t)
+(load-and-gc "international/charprop.el" t)
;; Load language-specific files.
-(load "language/chinese")
-(load "language/cyrillic")
-(load "language/indian")
-(load "language/sinhala")
-(load "language/english")
-(load "language/ethiopic")
-(load "language/european")
-(load "language/czech")
-(load "language/slovak")
-(load "language/romanian")
-(load "language/greek")
-(load "language/hebrew")
-(load "language/japanese")
-(load "language/korean")
-(load "language/lao")
-(load "language/tai-viet")
-(load "language/thai")
-(load "language/tibetan")
-(load "language/vietnamese")
-(load "language/misc-lang")
-(load "language/utf-8-lang")
-(load "language/georgian")
-(load "language/khmer")
-(load "language/burmese")
-(load "language/cham")
-
-(load "indent")
-(load "window")
-(load "frame")
-(load "term/tty-colors")
-(load "font-core")
+(load-and-gc "language/chinese")
+(load-and-gc "language/cyrillic")
+(load-and-gc "language/indian")
+(load-and-gc "language/sinhala")
+(load-and-gc "language/english")
+(load-and-gc "language/ethiopic")
+(load-and-gc "language/european")
+(load-and-gc "language/czech")
+(load-and-gc "language/slovak")
+(load-and-gc "language/romanian")
+(load-and-gc "language/greek")
+(load-and-gc "language/hebrew")
+(load-and-gc "language/japanese")
+(load-and-gc "language/korean")
+(load-and-gc "language/lao")
+(load-and-gc "language/tai-viet")
+(load-and-gc "language/thai")
+(load-and-gc "language/tibetan")
+(load-and-gc "language/vietnamese")
+(load-and-gc "language/misc-lang")
+(load-and-gc "language/utf-8-lang")
+(load-and-gc "language/georgian")
+(load-and-gc "language/khmer")
+(load-and-gc "language/burmese")
+(load-and-gc "language/cham")
+
+(load-and-gc "indent")
+(load-and-gc "window")
+(load-and-gc "frame")
+(load-and-gc "term/tty-colors")
+(load-and-gc "font-core")
;; facemenu must be loaded before font-lock, because `facemenu-keymap'
;; needs to be defined when font-lock is loaded.
-(load "facemenu")
-(load "emacs-lisp/syntax")
-(load "font-lock")
-(load "jit-lock")
+(load-and-gc "facemenu")
+(load-and-gc "emacs-lisp/syntax")
+(load-and-gc "font-lock")
+(load-and-gc "jit-lock")
(if (fboundp 'track-mouse)
(progn
- (load "mouse")
+ (load-and-gc "mouse")
(and (boundp 'x-toolkit-scroll-bars)
- (load "scroll-bar"))
- (load "select")))
-(load "emacs-lisp/timer")
-(load "isearch")
-(load "rfn-eshadow")
+ (load-and-gc "scroll-bar"))
+ (load-and-gc "select")))
+(load-and-gc "emacs-lisp/timer")
+(load-and-gc "isearch")
+(load-and-gc "rfn-eshadow")
(message "%s" (garbage-collect))
-(load "menu-bar")
-(load "paths.el") ;Don't get confused if someone compiled paths by mistake.
-(load "emacs-lisp/lisp")
-(load "textmodes/page")
-(load "register")
-(load "textmodes/paragraphs")
-(load "emacs-lisp/lisp-mode")
-(load "textmodes/text-mode")
-(load "textmodes/fill")
+(load-and-gc "menu-bar")
+(load-and-gc "paths.el") ;Don't get confused if someone compiled paths by mistake.
+(load-and-gc "emacs-lisp/lisp")
+(load-and-gc "textmodes/page")
+(load-and-gc "register")
+(load-and-gc "textmodes/paragraphs")
+(load-and-gc "emacs-lisp/lisp-mode")
+(load-and-gc "textmodes/text-mode")
+(load-and-gc "textmodes/fill")
(message "%s" (garbage-collect))
-(load "replace")
-(load "buff-menu")
+(load-and-gc "replace")
+(load-and-gc "buff-menu")
(if (fboundp 'x-create-frame)
(progn
- (load "fringe")
- (load "image")
- (load "international/fontset")
- (load "dnd")
- (load "mwheel")
- (load "tool-bar")))
+ (load-and-gc "fringe")
+ (load-and-gc "image")
+ (load-and-gc "international/fontset")
+ (load-and-gc "dnd")
+ (load-and-gc "mwheel")
+ (load-and-gc "tool-bar")))
(if (featurep 'x)
(progn
- (load "x-dnd")
- (load "term/common-win")
- (load "term/x-win")))
+ (load-and-gc "x-dnd")
+ (load-and-gc "term/common-win")
+ (load-and-gc "term/x-win")))
(message "%s" (garbage-collect))
(if (eq system-type 'windows-nt)
(progn
- (load "w32-vars")
- (load "term/common-win")
- (load "term/w32-win")
- (load "ls-lisp")
- (load "disp-table")
- (load "dos-w32")
- (load "w32-fns")))
+ (load-and-gc "w32-vars")
+ (load-and-gc "term/common-win")
+ (load-and-gc "term/w32-win")
+ (load-and-gc "ls-lisp")
+ (load-and-gc "disp-table")
+ (load-and-gc "dos-w32")
+ (load-and-gc "w32-fns")))
(if (eq system-type 'ms-dos)
(progn
- (load "dos-w32")
- (load "dos-fns")
- (load "dos-vars")
+ (load-and-gc "dos-w32")
+ (load-and-gc "dos-fns")
+ (load-and-gc "dos-vars")
;; Don't load term/common-win: it isn't appropriate for the `pc'
;; ``window system'', which generally behaves like a terminal.
- (load "term/pc-win")
- (load "ls-lisp")
- (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el
+ (load-and-gc "term/pc-win")
+ (load-and-gc "ls-lisp")
+ (load-and-gc "disp-table"))) ; needed to setup ibm-pc char set, see internal.el
(if (featurep 'ns)
(progn
- (load "emacs-lisp/easymenu") ;; for platform-related menu adjustments
- (load "term/ns-win")))
+ (load-and-gc "emacs-lisp/easymenu") ;; for platform-related menu adjustments
+ (load-and-gc "term/ns-win")))
(if (fboundp 'atan) ; preload some constants and
(progn ; floating pt. functions if we have float support.
- (load "emacs-lisp/float-sup")))
+ (load-and-gc "emacs-lisp/float-sup")))
(message "%s" (garbage-collect))
-(load "vc-hooks")
-(load "ediff-hook")
-(if (fboundp 'x-show-tip) (load "tooltip"))
+(load-and-gc "vc-hooks")
+(load-and-gc "ediff-hook")
+(if (fboundp 'x-show-tip) (load-and-gc "tooltip"))
(message "%s" (garbage-collect))
@@ -283,9 +287,12 @@
;;;Note: You can cause additional libraries to be preloaded
;;;by writing a site-init.el that loads them.
;;;See also "site-load" above.
-(load "site-init" t)
+(load-and-gc "site-init" t)
(setq current-load-list nil)
+;; Unbound the function, we don't need it elsewhere.
+(fmakunbound 'load-and-gc)
+
;; Write the value of load-history into fns-VERSION.el,
;; then clear out load-history.
;; (if (or (equal (nth 3 command-line-args) "dump")
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect
2009-08-31 14:46 ` bug#4287: reducing emacs size by more frequent garbage-collect Stefan Monnier
@ 2009-09-01 11:44 ` Juanma Barranquero
2009-09-01 16:21 ` Stefan Monnier
0 siblings, 1 reply; 15+ messages in thread
From: Juanma Barranquero @ 2009-09-01 11:44 UTC (permalink / raw
To: Stefan Monnier; +Cc: 4287
On Mon, Aug 31, 2009 at 16:46, Stefan Monnier<monnier@iro.umontreal.ca> wrote:
> We could replace the call from C to do-after-load-evaluation by
> Frun_hooks(Qafter-load-functions), either passing it the file name
> explicitly or making sure load-file-name is still set.
I think this would be a worthwhile change (regardless of the chosen
fix for the "load + gc" issue on startup.el).
Juanma
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect
2009-09-01 11:44 ` Juanma Barranquero
@ 2009-09-01 16:21 ` Stefan Monnier
2009-09-01 21:33 ` Juanma Barranquero
0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2009-09-01 16:21 UTC (permalink / raw
To: Juanma Barranquero; +Cc: 4287
>> We could replace the call from C to do-after-load-evaluation by
>> Frun_hooks(Qafter-load-functions), either passing it the file name
>> explicitly or making sure load-file-name is still set.
> I think this would be a worthwhile change (regardless of the chosen
> fix for the "load + gc" issue on startup.el).
Patches welcome,
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: reducing emacs size by more frequent garbage-collect
2009-09-01 16:21 ` Stefan Monnier
@ 2009-09-01 21:33 ` Juanma Barranquero
0 siblings, 0 replies; 15+ messages in thread
From: Juanma Barranquero @ 2009-09-01 21:33 UTC (permalink / raw
To: Stefan Monnier; +Cc: 4287
On Tue, Sep 1, 2009 at 18:21, Stefan Monnier<monnier@iro.umontreal.ca> wrote:
>> I think this would be a worthwhile change (regardless of the chosen
>> fix for the "load + gc" issue on startup.el).
>
> Patches welcome,
Adding after-load-functions seems easy enough, but you say "replace
the call from C to do-after-load-evaluation". It is unclear to me how
do you propose to run do-after-load-evaluation then.
Juanma
^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#4287: marked as done (reducing emacs size by more frequent garbage-collect calls in loadup.el)
2009-08-29 18:41 ` bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el Dan Nicolaescu
2009-08-29 21:34 ` Stefan Monnier
@ 2009-09-17 6:25 ` Emacs bug Tracking System
1 sibling, 0 replies; 15+ messages in thread
From: Emacs bug Tracking System @ 2009-09-17 6:25 UTC (permalink / raw
To: Dan Nicolaescu
[-- Attachment #1: Type: text/plain, Size: 964 bytes --]
Your message dated Wed, 16 Sep 2009 23:17:57 -0700 (PDT)
with message-id <200909170617.n8H6HvDs020712@godzilla.ics.uci.edu>
and subject line Re: bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
has caused the Emacs bug report #4287,
regarding reducing emacs size by more frequent garbage-collect calls in loadup.el
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)
--
4287: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4287
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems
[-- Attachment #2: Type: message/rfc822, Size: 3421 bytes --]
From: Dan Nicolaescu <dann@ics.uci.edu>
To: bug-gnu-emacs <bug-gnu-emacs@gnu.org>
Subject: reducing emacs size by more frequent garbage-collect calls in loadup.el
Date: Sat, 29 Aug 2009 11:41:58 -0700 (PDT)
Message-ID: <200908291841.n7TIfw4E003762@godzilla.ics.uci.edu>
As the Subject says, replacing each `load' line in loadup.el with
`load' + `garbage-collect' will reduce the size of the stripped emacs
binary: (.7 is before, .8 is after the change)
$ ls -l emacs-23.1.50.8 emacs-23.1.50.7
-rwx------ 1 dann dann 6722788 Jul 24 14:20 emacs-23.1.50.8*
-rwx------ 1 dann dann 6857956 Jul 24 14:20 emacs-23.1.50.7*
$ size emacs-23.1.50.8 emacs-23.1.50.7
text data bss dec hex filename
1883659 4833256 0 6716915 667df3 emacs-23.1.50.8
1883659 4968424 0 6852083 688df3 emacs-23.1.50.7
so we get about 2% reduction by doing something very simple and safe...
[This happens because loading multiple files generate more garbage that
can be collected, but it is not returned to the OS, so it appears in
the dumped image].
See the discussion on this topic on emacs-devel:
http://permalink.gmane.org/gmane.emacs.devel/113176
[-- Attachment #3: Type: message/rfc822, Size: 1962 bytes --]
From: Dan Nicolaescu <dann@ics.uci.edu>
To: 4287-done@emacsbugs.donarmstrong.com
Subject: Re: bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el
Date: Wed, 16 Sep 2009 23:17:57 -0700 (PDT)
Message-ID: <200909170617.n8H6HvDs020712@godzilla.ics.uci.edu>
This is done in CVS now.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2009-09-17 6:25 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <200909170617.n8H6HvDs020712@godzilla.ics.uci.edu>
2009-08-29 18:41 ` bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el Dan Nicolaescu
2009-08-29 21:34 ` Stefan Monnier
2009-08-30 6:09 ` Dan Nicolaescu
2009-08-30 18:00 ` Eli Zaretskii
2009-08-30 20:04 ` Stefan Monnier
2009-08-30 20:45 ` Juanma Barranquero
2009-08-31 14:46 ` bug#4287: reducing emacs size by more frequent garbage-collect Stefan Monnier
2009-09-01 11:44 ` Juanma Barranquero
2009-09-01 16:21 ` Stefan Monnier
2009-09-01 21:33 ` Juanma Barranquero
2009-08-30 23:55 ` bug#4287: reducing emacs size by more frequent garbage-collect calls in loadup.el Juri Linkov
2009-08-31 4:25 ` Dan Nicolaescu
2009-08-31 14:49 ` Stefan Monnier
2009-09-01 0:57 ` Dan Nicolaescu
2009-09-17 6:25 ` bug#4287: marked as done (reducing emacs size by more frequent garbage-collect calls in loadup.el) Emacs bug Tracking System
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.