c++ speed 3.3/4.0/4.1

Mike Stump mrs@apple.com
Mon Dec 5 23:39:00 GMT 2005


On Dec 5, 2005, at 2:33 PM, Jack Howarth wrote:
>     Do you mean using -fno-threadsafe-statics or do you have any other
> inlining changes in mind?

That option mentions the word inline 0 times, while interesting and  
worthwhile to test, I did mean these (from the man page):

-finline-limit=n

and --params:

            max-inline-insns-single
                Several parameters control the tree inliner used in  
gcc.  This
                number sets the maximum number of instructions  
(counted in
                GCC's internal representation) in a single function  
that the
                tree inliner will consider for inlining.  This only  
affects
                functions declared inline and methods implemented in  
a class
                declaration (C++).  The default value is 450.

            max-inline-insns-auto
                When you use -finline-functions (included in -O3), a  
lot of
                functions that would otherwise not be considered for  
inlining
                by the compiler will be investigated.  To those  
functions, a
                different (more restrictive) limit compared to functions
                declared inline can be applied.  The default value is  
90.

            inline-unit-growth
                Specifies maximal overall growth of the compilation  
unit caused
                by inlining.  This parameter is ignored when -funit- 
at-a-time
                is not used.  The default value is 50 which limits  
unit growth
                to 1.5 times the original size.

            max-inline-insns-recursive
            max-inline-insns-recursive-auto
                Specifies maximum number of instructions out-of-line  
copy of
                self recursive inline function can grow into by  
performing
                recursive inlining.

                For functions declared inline --param max-inline- 
insns-recur-
                sive is taken into acount.  For function not declared  
inline,
                recursive inlining happens only when -finline-functions
                (included in -O3) is enabled and --param max-inline- 
insns-
                recursive-auto is used.  The default value is 450.

            max-inline-recursive-depth
            max-inline-recursive-depth-auto
                Specifies maximum recursion depth used by the  
recursive inlin-
                ing.

                For functions declared inline --param max-inline- 
recursive-
                depth is taken into acount.  For function not  
declared inline,
                recursive inlining happens only when -finline-functions
                (included in -O3) is enabled and --param max-inline- 
recursive-
                depth-auto is used.  The default value is 450.

            inline-call-cost
                Specify cost of call instruction relative to simple  
arithmetics
                operations (having cost of 1).  Increasing this cost  
disqualify
                inlinining of non-leaf functions and at same time  
increase size
                of leaf function that is believed to reduce function  
size by
                being inlined.  In effect it increase amount of  
inlining for
                code having large abstraction penalty (many functions  
that just
                pass the argumetns to other functions) and decrease  
inlining
                for code with low abstraction penalty.  Default value  
is 16.

It is trivial to have these slightly alter codegen and show very  
large differences in timings.



More information about the Gcc mailing list