Skip site navigation (1) Skip section navigation (2)

Re: FunctionCallN improvement.

From: Mike Rylander <mrylander(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: a_ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp>, Neil Conway <neilc(at)samurai(dot)com>,pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: FunctionCallN improvement.
Date: 2005-02-02 01:12:04
Message-ID: b918cf3d05020117125b7f1e7c@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Tue, 01 Feb 2005 16:23:56 -0500, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> a_ogawa <a_ogawa(at)hi-ho(dot)ne(dot)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(at)weezie miker $ time ./pg_test -memset 1000000000
test MemSetLoop(2): 1000000000

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

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

real    0m4.217s
user    0m4.216s
sys     0m0.001s
miker(at)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(at)weezie miker $ time ./pg_test -memset 1000000000
test MemSetLoop(2): 1000000000

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

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

real    0m2.929s
user    0m2.926s
sys     0m0.000s
miker(at)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(at)weezie miker $ time ./pg_test -memset 1000000000
test MemSetLoop(5): 1000000000

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

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

real    0m4.177s
user    0m4.177s
sys     0m0.000s
miker(at)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(at)weezie miker $ time ./pg_test -memset 1000000000
test MemSetLoop(5): 1000000000

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

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

real    0m3.349s
user    0m3.345s
sys     0m0.000s
miker(at)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(at)gmail(dot)com
GPLS -- PINES Development
Database Developer
http://open-ils.org

In response to

Responses

pgsql-hackers by date

Next:From: Neil ConwayDate: 2005-02-02 01:12:41
Subject: Re: patch for temporary view from TODO list
Previous:From: Neil ConwayDate: 2005-02-01 23:08:27
Subject: Re: [NOVICE] Last ID Problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group