Re: Manipulating complex types as non-contiguous structures in-memory

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Manipulating complex types as non-contiguous structures in-memory
Дата
Msg-id 55311706.7020206@iki.fi
обсуждение исходный текст
Ответ на Re: Manipulating complex types as non-contiguous structures in-memory  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 04/17/2015 03:58 PM, Tom Lane wrote:
> Heikki Linnakangas <hlinnaka@iki.fi> writes:
>> On 03/28/2015 11:24 PM, Tom Lane wrote:
>>> +  * Macros for iterating through elements of a flat or expanded array.
>
>> How about a struct instead?
>
>> struct ArrayIter {
>>       Datum   datumptr;
>>       bool   isnullptr;
>>       char   dataptr;
>>       bits8  bitmapptr;
>>       int       bitmask
>> }
>
>> Seems more natural.
>
> Yes, and much less efficient I'm afraid.  Most compilers would be unable
> to put the variables into registers, which is important for these inner
> loops.

That would surprise me. Surely most compilers know to keep fields of a 
struct in registers, when the struct itself or a pointer to it is not 
passed anywhere.

>> How about turning these into functions?
>
> Likewise.  The point of doing it like this was to avoid taking an
> efficiency hit compared to the existing code.
>
> It's conceivable that we could avoid such a hit by marking the functions
> all "inline", but I'm not certain that they'd get inlined, and the
> question of whether the variables could be in registers would remain.

Ok, this one I believe.

- Heikki



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

Предыдущее
От: "Zhang Zq"
Дата:
Сообщение: patch for xidin
Следующее
От: Tom Lane
Дата:
Сообщение: Re: patch for xidin