Re: MemSet inline for newNode

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: MemSet inline for newNode
Дата
Msg-id 23217.1036983003@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: MemSet inline for newNode  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: MemSet inline for newNode  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> I thought someone had tested that there was little/no performance
> difference between these two statements:
>     MemSet(ptr, 0, 256)
> vs.
>     i = 256;
>     MemSet(ptr, 0, i)

But with any reasonably smart compiler, those *will* be the same because
the compiler can do constant-folding (ie, it knows i is 256 when control
reaches the MemSet).  Pushing the MemSet into MemoryContextAlloc
eliminates the possibility of knowing the size argument's value.

> I can back out my changes, but it would be easier to see if there is a
> benefit before doing that.  Personally, I am going to be surprised if a
> single conditional tests in MemSet (which is not in the assignment loop)
> will make any measurable difference.

Then why were we bothering?  IIRC, this was being sold as a performance
improvement.

            regards, tom lane

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

Предыдущее
От: Neil Conway
Дата:
Сообщение: more SGML fixes
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: MemSet inline for newNode