>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> I'm not sure that this would let us catch up to what Arjen Tom> reports as MySQL's expression evaluation
speed,but it should Tom> at least speed things up a bit with only fairly localized Tom> changes.
I like the idea of memoizing the switch with function pointers as I
don't think branch prediction helps much with varying switch arms
selected with different exprs. Also I agree that the delta of indirect
function invocation is probably small.
I've forgotten the syntax of case, but for the simple form isn't
expr=const going to be the same expr for each case arm ? If that's the
case, couldn't we actually save the value of expr in a Datum and then
reuse that (through a Const) in each of the other arms to evaluate the
actual exprs ? That should reduce the number of times ExecEvalVar (and
through it heapgetattr) are called.
--
Pip-pip
Sailesh
http://www.cs.berkeley.edu/~sailesh