Re: [PERFORM] A Better External Sort?

Поиск
Список
Период
Сортировка
От Ron Peacetree
Тема Re: [PERFORM] A Better External Sort?
Дата
Msg-id 8345217.1128432236685.JavaMail.root@elwamui-polski.atl.sa.earthlink.net
обсуждение исходный текст
Ответ на [PERFORM] A Better External Sort?  (Ron Peacetree <rjpeace@earthlink.net>)
Список pgsql-hackers
The constants related to inlining involve pcode, not actual assembly instructions, and are compiler version dependent
aswell as subject to change without notice by the GNU folks...
 

from:
http://gcc.gnu.org/onlinedocs/gcc-3.3.5/gcc/Optimize-Options.html#Optimize-Options

"-finline-limit=n
By default, gcc limits the size of functions that can be inlined. This flag allows the control of this limit for
functionsthat are explicitly marked as inline (i.e., marked with the inline keyword or defined within the class
definitionin c++). n is the size of functions that can be inlined in number of pseudo instructions (not counting
parameterhandling). The default value of n is 600. Increasing this value can result in more inlined code at the cost of
compilationtime and memory consumption. Decreasing usually makes the compilation faster and less code will be inlined
(whichpresumably means slower programs). This option is particularly useful for programs that use inlining heavily such
asthose based on recursive templates with C++.
 

Inlining is actually controlled by a number of parameters, which may be specified individually by using --param
name=value.The -finline-limit=n option sets some of these parameters as follows:
 
   max-inline-insns       is set to n.   max-inline-insns-single       is set to n/2.   max-inline-insns-auto       is
setto n/2.   min-inline-insns       is set to 130 or n/4, whichever is smaller.   max-inline-insns-rtl       is set to
n.
 

Using -finline-limit=600 thus results in the default settings for these parameters. See below for a documentation of
theindividual parameters controlling inlining.
 

Note: pseudo instruction represents, in this particular context, an abstract measurement of function's size. In no way,
itrepresents a count of assembly instructions and as such its exact meaning might change from one release to an
another."   
 
Further Down It Says...

"--param name=value
In some places, GCC uses various constants to control the amount of optimization that is done. For example, GCC will
notinline functions that contain more that a certain number of instructions. You can control some of these constants on
thecommand-line using the --param option.
 

The names of specific parameters, and the meaning of the values, are tied to the internals of the compiler, and are
subjectto change without notice in future releases.
 

In each case, the value is an integer. The allowable choices for name are given in the following table:
   <snip>      max-inline-insns-single
Several parameters control the tree inliner used in gcc. This number sets the maximum number of instructions (counted
ingcc's internal representation) in a single function that the tree inliner will consider for inlining. This only
affectsfunctions declared inline and methods implemented in a class declaration (C++). The default value is 300.
 
   max-inline-insns-auto
When you use -finline-functions (included in -O3), a lot of functions that would otherwise not be considered for
inliningby the compiler will be investigated. To those functions, a different (more restrictive) limit compared to
functionsdeclared inline can be applied. The default value is 300.
 
   max-inline-insns
The tree inliner does decrease the allowable size for single functions to be inlined after we already inlined the
numberof instructions given here by repeated inlining. This number should be a factor of two or more larger than the
singlefunction limit. Higher numbers result in better runtime performance, but incur higher compile-time resource (CPU
time,memory) requirements and result in larger binaries. Very high values are not advisable, as too large binaries may
adverselyaffect runtime performance. The default value is 600.      max-inline-slope
 
After exceeding the maximum number of inlined instructions by repeated inlining, a linear function is used to decrease
theallowable size for single functions. The slope of that function is the negative reciprocal of the number specified
here.The default value is 32.
 
   min-inline-insns
The repeated inlining is throttled more and more by the linear function after exceeding the limit. To avoid too much
throttling,a minimum for this function is specified here to allow repeated inlining for very small functions even when
alot of repeated inlining already has been done. The default value is 130.
 
   max-inline-insns-rtl
For languages that use the RTL inliner (this happens at a later stage than tree inlining), you can set the maximum
allowablesize (counted in RTL instructions) for the RTL inliner with this parameter. The default value is 600.
 


-----Original Message-----
From: Martijn van Oosterhout <kleptog@svana.org>
Sent: Oct 4, 2005 8:24 AM
To: Simon Riggs <simon@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Ron Peacetree <rjpeace@earthlink.net>, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] [PERFORM] A Better External Sort?

On Tue, Oct 04, 2005 at 12:24:54PM +0100, Simon Riggs wrote:
> How did you determine the 1500 figure? Can you give some more info to
> surround that recommendation to allow everybody to evaluate it?

kleptog@vali:~/dl/cvs/pgsql-local/src/backend/utils/sort$ gcc -finline-limit-1000 -Winline -O2 -Wall
-Wmissing-prototypes-Wpointer-arith -Wendif-labels -fno-strict-aliasing -g -I../../../../src/include -D_GNU_SOURCE   -c
-otuplesort.o tuplesort.c
 

<snip>

A quick binary search puts the cutoff between 1200 and 1300. Given
version variation I picked a nice round number, 1500.

Ugh, that's for -O2, for -O3 and above it needs to be 4100 to work.
Maybe we should go for 5000 or so.

I'm using: gcc (GCC) 3.3.5 (Debian 1:3.3.5-13)


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: New pg_config behavior
Следующее
От: Tom Lane
Дата:
Сообщение: Re: memory bug debugging