public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Faster compilation speed [zone allocation]
@ 2002-08-15 12:02 Robert Dewar
  2002-08-15 13:28 ` Lynn Winebarger
  0 siblings, 1 reply; 11+ messages in thread
From: Robert Dewar @ 2002-08-15 12:02 UTC (permalink / raw)
  To: aldyh, dje; +Cc: gcc, matz, per

<        Because the problem is not the garbage collection, its the
allocation pattern.  The proposal to use reference counting allows GCC to
switch to an allocator with better locality -- it's a requirement for the
underlying improvement, not a fix unto itself.
>

But removing garbage collection entirely certainly gives some information.
Another way of examining is to compile on a machine with a large level 2
cache, and watch the compilation time vs size of thing being compiled.

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Faster compilation speed
@ 2002-08-14 13:20 Michael Matz
  2002-08-14 16:31 ` Faster compilation speed [zone allocation] Per Bothner
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Matz @ 2002-08-14 13:20 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc

Hi,

On Wed, 14 Aug 2002, David Edelsohn wrote:

> |> 	Places where GCC could benefit from spacial locality is by
> |> allocating the instruction list and pseudo registers from a large, static
> |> virtual memory array instead of allocating individual objects dynamically.
>
> Andreas> Obstacks?
>
> 	I thought that obstacks are created dynamically, not statically.

Sort of.  Obstacks have the ability to grow an object which isn't yet
finalized, and in that process there might be some copying (the canonical
example is a string, which is created character by character).  After
finalization it doesn't change it's address anymore, but still is part of
that obstack.

One would not use that functionality, but simply use obstacks as
convenient containers for small objects, which are allocated already
finalized.  It allocates memory in blocks, and then gives out part of the
current block as long as enough is free in it, and the request is not
larger than a certain size (in which case it gets it's own block).  This
makes for extremely fast allocation (just a pointer increment in the
general case).  One can't deallocate objects in an obstack (or better only
all objects allocated after a certain one).  And it creates good space
locality, and needs less memory then a general allocator like malloc (in
case many small objects are allocated).

But that one can't free objects is a quite severe limitation (I wrote one
for KDE, in which you can free objects, but it has certain restrictions).
But it's still usable.  E.g. I use an obstack in the new register
allocator to allocate most of my small objects from it (nodes and edges of
the graph), and then simply free the whole thing once at the end of that
phase.  But that's not possible e.g. with the current RTL of the function,
there you really don't want to use an obstack.

> One does not want to ever copy or grow the array.

As explained, this doesn't happen if one uses the obstack without growing
objects.

> Statically allocating some of the large, persistent, sequential
> collections of objects would help locality.

This would lead to the idea of obstacks (without growing obstacks) per
data structure type, IOW to a zone allocator, which is not a bad thing.


Ciao,
Michael.

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

end of thread, other threads:[~2002-08-16  8:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-15 12:02 Faster compilation speed [zone allocation] Robert Dewar
2002-08-15 13:28 ` Lynn Winebarger
  -- strict thread matches above, loose matches on Subject: below --
2002-08-14 13:20 Faster compilation speed Michael Matz
2002-08-14 16:31 ` Faster compilation speed [zone allocation] Per Bothner
2002-08-15 11:34   ` Aldy Hernandez
2002-08-15 11:39     ` David Edelsohn
2002-08-15 12:01       ` Lynn Winebarger
2002-08-15 12:11         ` David Edelsohn
2002-08-15 11:41     ` Michael Matz
2002-08-16  8:44       ` Kai Henningsen
2002-08-15 11:43     ` Per Bothner
2002-08-15 11:57     ` Kevin Handy

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).