On Sun, Jun 5, 2022 at 10:20 AM Stefan Monnier <monnier@iro.umontreal.ca> wrote:

>> Also, what kind of startup time are you talking about?
>> E.g., are you using `package-quickstart`?
> That was the first alternative I tried.  With 1250 packages, it did not
> work.

Please `M-x report-emacs-bug` (and put me in `X-Debbugs-Cc`).


I was able to reproduce this at home on cygwin with 940 packages. I had
tried to install a few more than that (maybe 945 or something), I just
removed the corresponding sections of the last few until it did compile.
Then I verified that it didn't matter whether I removed the first or the last
package autoloads, I would get the overflow regardless.
After spending the weekend going over byte code examples, I  looked
at the output, and it's literally just hitting 64k instructions.   Each package
uses 17 instructions just putting itself on the loadpath, which accounts for ~15000
instructions.  That means every package uses about 50 instructions on average,
so (if that's representative), you wouldn't expect to be able to do much more than 300
or so additional packages just from putting those paths in an array and looping over them.
Most of the forms are just calls to a handful of operators with constant arguments,
so I would assume you could just create arrays for the most common instruction types, put the
argument lists in a giant vector, and then just loop over those vectors performing the operator.
Then there'd be a handful of oddball expressions to handle.

Or, you could just create a vector with one thunk for each package and loop through  it
invoking each one.  It wouldn't be as space efficient, but it would be trivially correct.

I'll put this in a bug report.

Lynn