public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* TREE_CODE mania
@ 2002-09-03 20:18 Devang Patel
  2002-09-03 20:50 ` Daniel Berlin
  2002-09-04  1:51 ` Neil Booth
  0 siblings, 2 replies; 8+ messages in thread
From: Devang Patel @ 2002-09-03 20:18 UTC (permalink / raw)
  To: gcc

Hi All,

Recently there was a discussion about faster compile time. And
memory usage and/or allocation is considered one probable
culprit behind the slow compiler.

To understand actual memory usage pattern, I instrumented GCC
by replacing TREE_CODE macro with function TREE_CODE_read().
I just wanted to see what is the usage pattern and how bad/good is it.

I collected profiled data for following one line program.

int foo() { return 1;}

Now, gprof tells me that to compile this, cc1 calls TREE_CODE_read()
37572 times! I was expecting that number to be in couple of thousands
range but 37k seems high to me.

I think, such a high number of indirect memory references puts
high  pressure on VM and GCC's memory manager to maintain locality.
May be we can do simple code reorganizations using few extra
local variables to reduce this pressure. Or may be I am unnecessarily
surprised by this number.

Here is relevant gprof data...

                 0.00        0.00     694/37572       _convert <cycle 1> 
[219]
                 0.00        0.00     826/37572       _pushdecl [211]
                 0.00        0.00     927/37572       _int_const_binop 
[23]
                 0.00        0.00    1019/37572       _round_type_align 
[171]
                 0.00        0.00    1027/37572       
_darwin_encode_section_info [194]
                 0.00        0.00    1155/37572       _layout_type 
<cycle 3> [10]
                 0.00        0.00    1306/37572       _tree_size [122]
                 0.00        0.00    1499/37572       
_finalize_type_size [28]
                 0.00        0.00    1674/37572       _integer_zerop 
[156]
                 0.00        0.00    2286/37572       _fold <cycle 1> 
[229]
                 0.00        0.00    2304/37572       _make_decl_rtl [16]
                 0.00        0.00    3193/37572       _integer_onep [135]
                 0.00        0.00    4488/37572       _size_binop [22]
                 0.00        0.00    5258/37572       _is_attribute_p 
[101]
                 0.00        0.00    6537/37572       _force_fit_type 
[114]
[91]     0.0    0.00        0.00   37572         _TREE_CODE_read [91]

Now in this data size_binop looks interesting. It is expensive and 
according
to gprof it is consuming 16% of total compile time.

[22]    16.7    0.00        0.01    1496         _size_binop [22]

-Devang

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

end of thread, other threads:[~2002-09-05  2:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-03 20:18 TREE_CODE mania Devang Patel
2002-09-03 20:50 ` Daniel Berlin
2002-09-04 10:19   ` Devang Patel
2002-09-04 16:04     ` Daniel Berlin
2002-09-04 19:51       ` Devang Patel
2002-09-04 10:23   ` Devang Patel
2002-09-04  1:51 ` Neil Booth
2002-09-04 10:15   ` Devang Patel

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