Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 7EDCA1337B4F for ; Thu, 28 Oct 2010 15:11:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 68158-01 for ; Thu, 28 Oct 2010 18:11:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp2.exchange.upenn.edu (smtp2.exchange.upenn.edu [128.91.3.225]) by mail.postgresql.org (Postfix) with ESMTP id D30701337B86 for ; Thu, 28 Oct 2010 15:11:13 -0300 (ADT) Received: from isc.upenn.edu (128.91.197.36) by smtp.exchange.upenn.edu (128.91.2.25) with Microsoft SMTP Server (TLS) id 8.2.213.0; Thu, 28 Oct 2010 14:11:11 -0400 Date: Thu, 28 Oct 2010 14:11:05 -0400 From: Garick Hamlin To: Andrew Dunstan CC: Tom Lane , Pavel Stehule , PostgreSQL-development , Tim Bunce Subject: Re: plperl arginfo Message-ID: <20101028181105.GA15019@isc.upenn.edu> References: <4CC995C2.3000704@dunslane.net> <16686.1288280351@sss.pgh.pa.us> <4CC9A4E2.9050604@dunslane.net> <20300.1288283668@sss.pgh.pa.us> <4CC9ACDC.9090508@dunslane.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <4CC9ACDC.9090508@dunslane.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/2000 X-Sequence-Number: 173040 On Thu, Oct 28, 2010 at 01:03:24PM -0400, Andrew Dunstan wrote: > > > On 10/28/2010 12:34 PM, Tom Lane wrote: > > > > BTW, maybe we could have the best of both worlds? Dunno about Perl, > > but in some languages it would be possible to instantiate the hash > > only if it's actually touched. Passing the data as a hash definitely > > seems to fit with the spirit of things otherwise, so as long as it > > didn't cost cycles when not needed, I'd be in favor of that API. > > Maybe, but I think that's getting rather beyond my perlguts-fu. I think > we'd need to do that via PERL_MAGIC_tied, but it's new territory for me. > Anyone else want to chime in? Warning, I don't know the plperl, I am just a perl coder. I do think all the anonymous array are worth worrying about in terms of performance. I don't think that tie is necessarily good for performance. tie() is not generally fast. I think you'd likely be better off writing plain accessors or using a function to add type info. Use an accessor for type information, like this? $ref->typeof($key) ... or perhaps use a special function? add_type_info(\%args); ... or if you want attibute based syntax sugar for the add_type_info() solution... my %args : pg_record(add_type_info); Again, these I don't know the plperl code, so I might be missing something here. Garick > > cheers > > andrew > > > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers