Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of jjore (6662)

Saturday October 06, 2007
10:53 PM

Faster perl / smaller PostgreSQL

[ #34624 ]

I've two work-related thoughts I'd like to explore a little. The first is that I've noticed that the cost of invoking a very small XS accessor/mutator is about the same cost as doing a newSVsv(...) inside it. It occurs to me that I could avoid some copies if lexicals being passed into my accessor were marked as SvTMP if their use was the last mention in the calling code.

Consider:

{
    my $foo = 1;
    bar( $foo ); # $foo is now stealable
}

I imagine I'd go through the compiled code, find the points where lexicals are last used and insert an operation just prior which would turn the TMP flag on. This is trading a bit of additional space and runtime length for avoiding copies of data. Maybe it helps. Dunno.

Here's the other thought. At work I have lots of records for households of people. To efficiently search for a person and their household, a single household record is exploded out to one for all the people in the dwelling. PostgreSQL has usertypes. I've thought it would be nice to store a set of last names (among other fields) in an array.

Initially looking, the PostgreSQL GIN index type appears to do most of this natively already. I've a drawback in that I can't use multicolumn GIN indexes. :-(

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.