Re: Optimize PL/Perl function argument passing [PATCH]

From: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optimize PL/Perl function argument passing [PATCH]
Date: 2010-12-08 17:14:31
Message-ID: 20101208171431.GT89294@timac
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 07, 2010 at 10:00:28AM -0500, Andrew Dunstan wrote:
>
>
> On 12/07/2010 09:24 AM, Tim Bunce wrote:
> >Changes:
> >
> > Sets the local $_TD via C instead of passing an extra argument.
> > So functions no longer start with "our $_TD; local $_TD = shift;"
> >
> > Pre-extend stack for trigger arguments for slight performance gain.
> >
> >Passes installcheck.
>
> Please add it to the January commitfest.

Done. https://commitfest.postgresql.org/action/patch_view?id=446

> Have you measured the speedup gained from this?

No. I doubt it's significant, but "every little helps" :)

> Do you have any more improvements in the pipeline?

I'd like to add $arrayref = decode_array_literal('{2,3}') and
maybe $hashref = decode_hstore_literal('x=>1, y=>2').
I don't know how much works would be involved in those though.

Another possible improvement would be rewriting encode_array_literal()
in C, so returning arrays would be much faster.

I'd also like to #define PERL_NO_GET_CONTEXT, which would give a useful
performance boost by avoiding all the many hidden calls to lookup
thread-local storage. (PERL_SET_CONTEXT() would go and instead the
'currrent interpreter' would be passed around as an extra argument.)
That's a fairly mechanical change but the diff may be quite large.

Tim.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2010-12-08 17:18:42 Re: plperlu problem with utf8
Previous Message Tom Lane 2010-12-08 17:14:08 Re: unlogged tables