On 01/19/2016 02:44 AM, Ken Raeburn wrote: > >> 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 machine. 'src/temacs -Q` takes ~5.5s. >> >> It seems not only machines have become faster, Emacs has grown quite a bit, too. :) > > It’s also pretty aggressive about garbage collection after loading any code before the unexec. Presumably that’s to minimize the storage needed for the shared on-disk image. > > 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