garbage-collect not called for .el files in loadup.el

View: New views
4 Messages — Rating Filter:   Alert me  

garbage-collect not called for .el files in loadup.el

by Dan Nicolaescu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


As the subject says, GC is not done after loading .el files in
loadup.el, only .elc files.  

These files are loaded with `load-with-code-conversion', which does:
      (unless purify-flag
         (do-after-load-evaluation fullname))

do-after-load-evaluation runs the `after-load-functions' hook.

So hoa bout this patch?

Index: mule.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/international/mule.el,v
retrieving revision 1.290
diff -u -3 -p -u -p -r1.290 mule.el
--- mule.el   26 Oct 2009 15:18:04 -0000        1.290
+++ mule.el   4 Nov 2009 01:53:55 -0000
@@ -353,7 +353,8 @@ Return t if file exists."
                  ))
                  (let (kill-buffer-hook kill-buffer-query-functions)
                    (kill-buffer buffer)))
-      (unless purify-flag
+      (if purify-flag
+        (run-hook-with-args 'after-load-functions fullname)
        (do-after-load-evaluation fullname))
 
       (unless (or nomessage noninteractive)



Re: garbage-collect not called for .el files in loadup.el

by Stefan Monnier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> As the subject says, GC is not done after loading .el files in
> loadup.el, only .elc files.

What difference does it make in practice?

> -      (unless purify-flag
> +      (if purify-flag
> +        (run-hook-with-args 'after-load-functions fullname)
>         (do-after-load-evaluation fullname))

Nope, sorry, that's ugly.  You can simply remove the `unless
purify-flag' on the other hand, since Fload calls
do-after-load-evaluation unconditionally.


        Stefan



Re: garbage-collect not called for .el files in loadup.el

by Dan Nicolaescu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Stefan Monnier <monnier@...> writes:

  > > As the subject says, GC is not done after loading .el files in
  > > loadup.el, only .elc files.
  >
  > What difference does it make in practice?

More garbage is produced before gc, so the memory layout is worse.


  > > -      (unless purify-flag
  > > +      (if purify-flag
  > > +        (run-hook-with-args 'after-load-functions fullname)
  > >         (do-after-load-evaluation fullname))
  >
  > Nope, sorry, that's ugly.  You can simply remove the `unless
  > purify-flag' on the other hand, since Fload calls
  > do-after-load-evaluation unconditionally.

Not when using `load-source-file-function':

      /* We are loading a source file (*.el).  */
      if (!NILP (Vload_source_file_function))
        {
          Lisp_Object val;

          if (fd >= 0)
            emacs_close (fd);
          val = call4 (Vload_source_file_function, found, hist_file_name,
                       NILP (noerror) ? Qnil : Qt,
                       (NILP (nomessage) || force_load_messages) ? Qnil : Qt);
          return unbind_to (count, val);
        }



Re: garbage-collect not called for .el files in loadup.el

by Stefan Monnier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> > As the subject says, GC is not done after loading .el files in
>> > loadup.el, only .elc files.
>> What difference does it make in practice?
> More garbage is produced before gc, so the memory layout is worse.

That's obvious, but that doesn't tell me "what difference does it make
in practice?".

>> > -      (unless purify-flag
>> > +      (if purify-flag
>> > +        (run-hook-with-args 'after-load-functions fullname)
>> >         (do-after-load-evaluation fullname))
>>
>> Nope, sorry, that's ugly.  You can simply remove the `unless
>> purify-flag' on the other hand, since Fload calls
>> do-after-load-evaluation unconditionally.

> Not when using `load-source-file-function':

That's not what I meant.  I meant that Fload doesn't check purify-flag
before calling do-after-load-evaluation.


        Stefan