unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Does a larger gc-cons-threshold mean a faster Emacs?
@ 2002-07-27  1:17 Kevin A. Burton
  2002-07-28  2:42 ` Richard Stallman
  2002-07-28 18:07 ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin A. Burton @ 2002-07-27  1:17 UTC (permalink / raw)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


OK...

I sent an email about my GC problems a while back but only RMS replied.  I am
still going to spend some time to debug what is going on but:

    gc-cons-threshold's value is 4194304

    Documentation:
    *Number of bytes of consing between garbage collections.
    Garbage collection can happen automatically once this many bytes have been
    allocated since the last garbage collection.  All data types count.

    Garbage collection happens automatically only when `eval' is called.

    By binding this temporarily to a large number, you can effectively
    prevent garbage collection during a part of the program.

This would lead me to believe that setting this to a large value would:

1. Take up a lot of memory
2. Increase the perceived Emacs speed

Right now I have it set to :

(setq gc-cons-threshold (* 8192 8192))

Which seems to yield decent speed (though Emacs uses 50M)

If I set it to anything higher... I get CONSTANT gc and lock my CPU at 100%
(emacs is dead)

This does not seem like the right behavior.  Why would it constantly GC?

Also... would it be acceptable to run an idle timer to run GC for me (in the
background)?

Kevin

- -- 
Kevin A. Burton ( burton@apache.org, burton@openprivacy.org, burton@peerfear.org )
             Location - San Francisco, CA, Cell - 415.595.9965
        Jabber - burtonator@jabber.org,  Web - http://www.peerfear.org/
        GPG fingerprint: 4D20 40A0 C734 307E C7B4  DCAA 0303 3AC5 BD9D 7C4D
         IRC - openprojects.net #infoanarchy | #p2p-hackers | #reptile

At the outset, we must comment on the ironic incongruity of permitting the
Recording Industry Association of America to testify at a hearing focused on
the 'Theft of American Intellectual Property'.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt

iD8DBQE9QfSqAwM6xb2dfE0RAppMAKCiK3fBbL5IP+pMQLCS0w0Zzf6diACgySYa
asBa9YMbVi7cOELBsPFs20A=
=0a6V
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does a larger gc-cons-threshold mean a faster Emacs?
  2002-07-27  1:17 Does a larger gc-cons-threshold mean a faster Emacs? Kevin A. Burton
@ 2002-07-28  2:42 ` Richard Stallman
  2002-07-28  2:54   ` Kevin A. Burton
  2002-07-28 18:07 ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2002-07-28  2:42 UTC (permalink / raw)
  Cc: emacs-devel

    Subject: Does a larger gc-cons-threshold mean a faster Emacs?

Up to a point, yes.

    (setq gc-cons-threshold (* 8192 8192))

    Which seems to yield decent speed (though Emacs uses 50M)

    If I set it to anything higher... I get CONSTANT gc and lock my CPU at 100%
    (emacs is dead)

Precisely what larger value did you use?  Was it so large
that it caused arithmetic overflow and gave you a negative number?


If you used a sufficiently large value, it would overflow.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does a larger gc-cons-threshold mean a faster Emacs?
  2002-07-28  2:42 ` Richard Stallman
@ 2002-07-28  2:54   ` Kevin A. Burton
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin A. Burton @ 2002-07-28  2:54 UTC (permalink / raw)
  Cc: emacs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard Stallman <rms@gnu.org> writes:

<snip/>

> Precisely what larger value did you use?  Was it so large
> that it caused arithmetic overflow and gave you a negative number?
> 
> If you used a sufficiently large value, it would overflow.
<snip/>

Ug... yes.  That is EXACTLY what I did... thanks. (duh!)

- -- 
Kevin A. Burton ( burton@apache.org, burton@openprivacy.org, burton@peerfear.org )
             Location - San Francisco, CA, Cell - 415.595.9965
        Jabber - burtonator@jabber.org,  Web - http://www.peerfear.org/
        GPG fingerprint: 4D20 40A0 C734 307E C7B4  DCAA 0303 3AC5 BD9D 7C4D
         IRC - openprojects.net #infoanarchy | #p2p-hackers | #reptile

Windows XP.  Now with more evil in every box!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt

iD8DBQE9Q1zsAwM6xb2dfE0RAsBvAJ9OU1Ra2M6dJYcAs4Lou3QCdXDEqQCfYh9R
Sf1zNcwyRI616JSr+Kjsal8=
=HCGB
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does a larger gc-cons-threshold mean a faster Emacs?
  2002-07-27  1:17 Does a larger gc-cons-threshold mean a faster Emacs? Kevin A. Burton
  2002-07-28  2:42 ` Richard Stallman
@ 2002-07-28 18:07 ` Eli Zaretskii
  2002-07-28 23:44   ` Kevin A. Burton
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2002-07-28 18:07 UTC (permalink / raw)
  Cc: emacs-devel

> From: burton@openprivacy.org
> Date: 26 Jul 2002 18:17:30 -0700
> 
> This would lead me to believe that setting this to a large value would:
> 
> 1. Take up a lot of memory
> 2. Increase the perceived Emacs speed
> 
> Right now I have it set to :
> 
> (setq gc-cons-threshold (* 8192 8192))
> 
> Which seems to yield decent speed (though Emacs uses 50M)

Not exactly: it also makes each GC significantly slower (in my
experience).  With the default threshold, each GC is over very
quickly (on a decent machine).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does a larger gc-cons-threshold mean a faster Emacs?
  2002-07-28 18:07 ` Eli Zaretskii
@ 2002-07-28 23:44   ` Kevin A. Burton
  2002-07-29  4:55     ` Eli Zaretskii
  2002-07-29 17:30     ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin A. Burton @ 2002-07-28 23:44 UTC (permalink / raw)
  Cc: emacs-devel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

"Eli Zaretskii" <eliz@is.elta.co.il> writes:

> > From: burton@openprivacy.org
> > Date: 26 Jul 2002 18:17:30 -0700
> > 
> > This would lead me to believe that setting this to a large value would:
> > 
> > 1. Take up a lot of memory
> > 2. Increase the perceived Emacs speed
> > 
> > Right now I have it set to :
> > 
> > (setq gc-cons-threshold (* 8192 8192))
> > 
> > Which seems to yield decent speed (though Emacs uses 50M)
> 
> Not exactly: it also makes each GC significantly slower (in my experience).
> With the default threshold, each GC is over very quickly (on a decent
> machine).
<snip/>

The problem is that the GC happens synchronously while running emacs.  I have
increased the gc-cons-threshold and at the same time installed an idle timer to
run GC in the background... :)

Kevin

- -- 
Kevin A. Burton ( burton@apache.org, burton@openprivacy.org, burton@peerfear.org )
             Location - San Francisco, CA, Cell - 415.595.9965
        Jabber - burtonator@jabber.org,  Web - http://www.peerfear.org/
        GPG fingerprint: 4D20 40A0 C734 307E C7B4  DCAA 0303 3AC5 BD9D 7C4D
         IRC - openprojects.net #infoanarchy | #p2p-hackers | #reptile

Give a man a flame and keep him warm for the night. Set him on fire and keep
him warm for the rest of his life.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt

iD8DBQE9RIHGAwM6xb2dfE0RAvwZAKC8Qm8mosTpENWNm/t0t3XIAKPRowCfStBL
oLt+bea+dYZoXPUXOBgFz+4=
=mVyF
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does a larger gc-cons-threshold mean a faster Emacs?
  2002-07-28 23:44   ` Kevin A. Burton
@ 2002-07-29  4:55     ` Eli Zaretskii
  2002-07-29 17:30     ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2002-07-29  4:55 UTC (permalink / raw)
  Cc: emacs-devel


On 28 Jul 2002 burton@openprivacy.org wrote:

> I [...] installed an idle timer to run GC in the background... :)

That shouldn't be necessary: Emacs already does GC when it's idle.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Does a larger gc-cons-threshold mean a faster Emacs?
  2002-07-28 23:44   ` Kevin A. Burton
  2002-07-29  4:55     ` Eli Zaretskii
@ 2002-07-29 17:30     ` Richard Stallman
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2002-07-29 17:30 UTC (permalink / raw)
  Cc: eliz, emacs-devel

    > Not exactly: it also makes each GC significantly slower (in my experience).

Part of GC spends time on garbage, but most of GC spends its time only
on live data.  So the time should be determined more by the amount of
live data than by the amount of garbage, unless there is lots and lots
of garbage.  Until the gc-cons-threshold becomes a few times the total
amount of live data, I'd expect increases in it not to cause any
slowdown.

Perhaps gc-cons-threshold should be a float which expresses a fraction
of the total amount of live data as of the last GC.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-07-29 17:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-27  1:17 Does a larger gc-cons-threshold mean a faster Emacs? Kevin A. Burton
2002-07-28  2:42 ` Richard Stallman
2002-07-28  2:54   ` Kevin A. Burton
2002-07-28 18:07 ` Eli Zaretskii
2002-07-28 23:44   ` Kevin A. Burton
2002-07-29  4:55     ` Eli Zaretskii
2002-07-29 17:30     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).