Re: Optimize PL/Perl function argument passing [PATCH] - Mailing list pgsql-hackers

From Tim Bunce
Subject Re: Optimize PL/Perl function argument passing [PATCH]
Date
Msg-id 20101208171431.GT89294@timac
Whole thread Raw
In response to Re: Optimize PL/Perl function argument passing [PATCH]  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Optimize PL/Perl function argument passing [PATCH]
List 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.


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: unlogged tables
Next
From: "David E. Wheeler"
Date:
Subject: Re: plperlu problem with utf8