Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gc-cons-threshold startup time speedup #3011

Closed
CarlQLange opened this issue Sep 13, 2015 · 9 comments
Closed

gc-cons-threshold startup time speedup #3011

CarlQLange opened this issue Sep 13, 2015 · 9 comments

Comments

@CarlQLange
Copy link
Contributor

Hey,

I guess this is more a system-specific thing, in that it probably shouldn't be set by default, but setting (setq gc-cons-threshold 100000000) as the first line in init.el took my startup time from 5.5s to 3.5, which is a pretty decent improvement. (Yes, I use emacs as a persistent server, emacsclient etc, but still, I like short startup times)

I guess just a thought? I'm sure everyone's seen the thread on reddit I got the idea from.

Cheers

@bmag
Copy link
Contributor

bmag commented Sep 13, 2015

There already is a similar line in https://github.com/syl20bnr/spacemacs/blob/develop/layers/%2Bdistribution/spacemacs-core/config.el#L229, but I guess it's executed a bit too late to help startup time? Moving that line to init.el didn't help much in my case (from ~3.7s to ~3.3s)

@CarlQLange
Copy link
Contributor Author

Didn't help much? Maybe it's the old game dev in me coming out, but 400ms is a super long time! :)
In any case, I think you're right - that should be moved to very early in init.el.

I also experimented with compiling all the elisp in .emacs.d/, and while i did come out of that with a 200ms improvement I don't think it's worth the hassle.

@CarlQLange
Copy link
Contributor Author

Also, man the Spacemacs architecture has changed since I last contributed in like March... +distributions? Are there gonna be others?

@TheBB
Copy link
Contributor

TheBB commented Sep 13, 2015

See #2937 for that.

@syl20bnr
Copy link
Owner

I made the change, thank you :-)

@person808
Copy link
Contributor

It may be good to restore it to be closer to the default after init finishes. See this comment

@syl20bnr
Copy link
Owner

Indeed, thank you ! PR welcome :-)

dcluna pushed a commit to dcluna/spacemacs that referenced this issue Sep 14, 2015
@synic
Copy link
Contributor

synic commented Sep 15, 2015

I guess you all saw the same reddit thread I did. After I read it, I went searching for the proper value to set it to, and found this:

http://lists.gnu.org/archive/html/help-gnu-emacs/2007-09/msg00241.html

From the email:

There used to be some benefit to setting it higher for large Emacs sessions
(where GC can take a long time) since it would reduce the frequency of those
GCs. In Emacs-22, this is not needed any more because of the new
`gc-cons-percentage' variable which automatically causes the limit to grow
as the Emacs process grows, thus preserving a more or less constant
GC overhead.

It makes me wonder if manually setting gc-cons-threshold will end up disabling this other feature, which was created to solve this issue.

@syl20bnr
Copy link
Owner

Good question I think it does not, or it would be surprising it does. Setting this variable should set the initial amount but not prevent the % feature to happen.
It has to be verified by monitoring the amount of GCed memory. This is the kind of metric that would be helpful to plot with dotspacemacs-configuration-layers set to all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants