From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | vadim(at)sable(dot)krasnoyarsk(dot)su (Vadim B(dot) Mikheev) |
Cc: | hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] inlining |
Date: | 1998-01-30 15:59:15 |
Message-ID: | 199801301600.LAA27821@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>
> Bruce Momjian wrote:
> >
> > Let me add, I am not inlining all the functions, but only the top part
> > of them that deals with cachoffsets and nulls. These are the easy ones,
> > and the ones that get used most often.
>
> fastgetattr() is called from a HUNDREDS places - I'm not sure that
> this is good idea.
Here is the fastgetattr macro. Again, I just inlined the cacheoffset
and null handlling at the top. Doesn't look like much code, though the
?: macro format makes it look larger. What do you think?
I did the same with fastgetiattr, which in fact just called
index_getattr, so that is gone now. For getsysattr, I made an array of
offsetof(), and do a lookup into the array from heap_getattr, so that is
gone too.
---------------------------------------------------------------------------
#define fastgetattr(tup, attnum, tupleDesc, isnull) \
( \
AssertMacro((attnum) > 0) ? \
( \
((isnull) ? (*(isnull) = false) : (dummyret)NULL), \
HeapTupleNoNulls(tup) ? \
( \
((tupleDesc)->attrs[(attnum)-1]->attcacheoff > 0) ? \
( \
(Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \
(char *) (tup) + (tup)->t_hoff + (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \
) \
: \
( \
((attnum)-1 > 0) ? \
( \
(Datum)fetchatt(&((tupleDesc)->attrs[0]), (char *) (tup) + (tup)->t_hoff) \
) \
: \
( \
nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
) \
) \
) \
: \
( \
att_isnull((attnum)-1, (tup)->t_bits) ? \
( \
((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
(Datum)NULL \
) \
: \
( \
nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
) \
) \
) \
: \
( \
(Datum)NULL \
) \
)
>
> I suggest to inline _entire_ body of this func in the
> execQual.c:ExecEvalVar() - Executor uses _only_ ExecEvalVar() to get
> data from tuples.
>
> (We could #define FASTGETATTR macro and re-write fastgetattr() as just
> this macro "call".)
>
> I don't know should we follow the same way for fastgetiattr() or not...
>
> Vadim
>
--
Bruce Momjian
maillist(at)candle(dot)pha(dot)pa(dot)us
From | Date | Subject | |
---|---|---|---|
Next Message | Vadim B. Mikheev | 1998-01-30 16:19:59 | Re: [HACKERS] inlining |
Previous Message | Marc Howard Zuckman | 1998-01-30 14:39:54 | Re: [HACKERS] Current open 6.3 issues (fwd) |