Re: FunctionCallN improvement. - Mailing list pgsql-hackers

From Mike Rylander
Subject Re: FunctionCallN improvement.
Date
Msg-id b918cf3d05020117125b7f1e7c@mail.gmail.com
Whole thread Raw
In response to Re: FunctionCallN improvement.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: FunctionCallN improvement.
List pgsql-hackers
On Tue, 01 Feb 2005 16:23:56 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> a_ogawa <a_ogawa@hi-ho.ne.jp> writes:
> > I made the test program to measure the effect of this macro.
> 
> Well, if we're going to be tense about this, let's actually be tense
> about it.  Your test program isn't a great model for what's going to
> happen in fmgr.c, because you've designed it so that Nargs cannot be
> known at compile time.  In the fmgr routines, Nargs is certainly a
> compile-time constant, and so implementations that can exploit that
> will have an advantage.
> 

<big snip>

Here are some numbers for AMD64 (gcc -O2 -I
/opt/include/postgresql/server/ pg_test.c -o pg_test):

miker@weezie miker $ time ./pg_test -memset 1000000000
test MemSetLoop(2): 1000000000

real    1m15.896s
user    1m15.881s
sys     0m0.006s
miker@weezie miker $ time ./pg_test -origmacro 1000000000
test OrigMacro(2): 1000000000

real    0m4.217s
user    0m4.215s
sys     0m0.001s
miker@weezie miker $ time ./pg_test -setmacro 1000000000
test SetMacro(2): 1000000000

real    0m4.217s
user    0m4.216s
sys     0m0.001s
miker@weezie miker $ time ./pg_test -unrolled 1000000000
test Unrolled(2): 1000000000

real    0m4.218s
user    0m4.215s
sys     0m0.002s


and now with -O6:

miker@weezie miker $ time ./pg_test -memset 1000000000
test MemSetLoop(2): 1000000000

real    1m13.624s
user    1m13.542s
sys     0m0.001s
miker@weezie miker $ time ./pg_test -origmacro 1000000000
test OrigMacro(2): 1000000000

real    0m2.929s
user    0m2.926s
sys     0m0.001s
miker@weezie miker $ time ./pg_test -setmacro 1000000000
test SetMacro(2): 1000000000

real    0m2.929s
user    0m2.926s
sys     0m0.000s
miker@weezie miker $ time ./pg_test -unrolled 1000000000
test Unrolled(2): 1000000000

real    0m2.510s
user    0m2.508s
sys     0m0.001s


Now with NARGS = 5, -O2:

miker@weezie miker $ time ./pg_test -memset 1000000000
test MemSetLoop(5): 1000000000

real    1m15.204s
user    1m15.175s
sys     0m0.002s
miker@weezie miker $ time ./pg_test -origmacro 1000000000
test OrigMacro(5): 1000000000

real    0m10.027s
user    0m10.022s
sys     0m0.001s
miker@weezie miker $ time ./pg_test -setmacro 1000000000
test SetMacro(5): 1000000000

real    0m4.177s
user    0m4.177s
sys     0m0.000s
miker@weezie miker $ time ./pg_test -unrolled 1000000000
test Unrolled(5): 1000000000

real    0m5.013s
user    0m5.011s
sys     0m0.000s

And once more, with -O6:

miker@weezie miker $ time ./pg_test -memset 1000000000
test MemSetLoop(5): 1000000000

real    1m47.090s
user    1m46.972s
sys     0m0.000s
miker@weezie miker $ time ./pg_test -origmacro 1000000000
test OrigMacro(5): 1000000000

real    0m8.367s
user    0m8.358s
sys     0m0.000s
miker@weezie miker $ time ./pg_test -setmacro 1000000000
test SetMacro(5): 1000000000

real    0m3.349s
user    0m3.345s
sys     0m0.000s
miker@weezie miker $ time ./pg_test -unrolled 1000000000
test Unrolled(5): 1000000000

real    0m3.347s
user    0m3.343s
sys     0m0.000s


Hope the numbers help!

-- 
Mike Rylander
mrylander@gmail.com
GPLS -- PINES Development
Database Developer
http://open-ils.org


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: [NOVICE] Last ID Problem
Next
From: John Hansen
Date:
Subject: Re: [NOVICE] Last ID Problem