develooper Front page | perl.dbi.dev | Postings from February 2012

Re: speeding up XS_DBI_dispatch()

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
February 5, 2012 13:04
Subject:
Re: speeding up XS_DBI_dispatch()
Message ID:
20120205210423.GA2880@iabyn.com
On Mon, Jan 30, 2012 at 10:56:37PM +0000, Tim Bunce wrote:
> On Mon, Jan 30, 2012 at 12:48:32PM +0000, Dave Mitchell wrote:
> > So I'm tempted to stick with the magic approach. I could optimise
> > it to assume the cache magic is always the first one (and if not, take a
> > slower route that finds and then moves it to the top).
> 
> That would be neat. Thanks.
> 
> dbih_getcom2 does the first part of that when looking up DBI hande
> magic. I never added the "move to the top" because I figured it would be
> very rare for magic to get added to the inner hash of a DBI handle.
> It seems even less likely that someone would add magic to a DBI method,
> but you never know. Unless you can think of a plausible case I'd be
> happy if you just added the short-cut+fallback and skipped the shuffle.

I'd already written the magic shuffler code by the time I saw your email,
so unless you want me to rip it out, it's your's fro free!

Anyway, attached is the final patch.
I've tested it under 5.8.1, 5.8.9, 5.14.2 and 5.15.7, with various
permutations of threaded builds.

It took quite a bit more work from the initial draft I showed you, mainly
getting the threaded stuff right, and a stupid PL_generation /
PL_sub_generation mix-up. I knew what the difference was between the two
vars, but whenever I visually inspected the code, I kept seeing the former
as the latter and couldn't understand why cache invalidation didn't work!


-- 
Little fly, thy summer's play my thoughtless hand
has terminated with extreme prejudice.
        (with apologies to William Blake)


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About