This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Faster compilation speed: cache behavior


Devang Patel wrote:
For above program, top candidates are:

                        Number         Bytes     %Total
identifier_node         786              49k     35.143
tree_list               281            5620       4.276
Data structures that take a TREE_LIST should be changed to
use TREE_VEC instead.  It's more compact, has better locality,
and is generally better and faster.

The only place where TREE_LIST may be useful is in temporary
lists, while we're actually *constructing* a list.  But in most
of those cases we can use a temporary obstack to collect the
items, and when done copy the items into a TREE_VEC of the
correct size.

Examples where we use TREE_LIST include argument lists in a
CALL_EXPR, formal parameter types in a FUNCTION_TYPE or METHOD_TYPE,
and CONSTRUCTOR values.  In all those cases, the length of the
list does not change once the node has been created, so a
TREE_VEC is just fine.

(Arrays are of course also more efficient for data structures that may
change size, if you're willing to have non-full arrays and re-allocate
them when full.)
--
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]