Subject: bug#19390: 25.0.50; `package-activate' is too slow

From: Stefan Monnier <[email-masked]>
Date: Thu, 18 Dec 2014 23:31:30 -0500

> `require' is only ever called as part of loading package (or doing
> some other processing).

There are a few places where we `require' inside a function that can be
called repeatedly, on the assumption that in most cases, this `require'
will be "instantaneous".  I'd rather not re-consider this
performance choice.

I'm OK with slowing down require like you suggested (that was actually
my original suggestion to handle the byte-compilation breakage during
package upgrade), but then we'd only want to do it in some specific
contexts (during byte-compilation) rather than all the time.

> When `autoload' is called, if the function in question is completely
> defined (instead of not defined or just autoloaded), `autoload' will
> check if the file it was given is a different file from the one the
> function was defined in (when we know that file).
> If it is then all is fine, if it wasn't then it loads the new file.

So we first add handling for `require', then another for `autoload',
... in the end I can't believe it can be simpler than what we have
(which has 0 cost in normal use, and a very small extra cost during
package upgrade).

        Stefan