develooper Front page | perl.perl5.porters | Postings from March 2010

Re: Another optimization question: bsearch()

Thread Previous | Thread Next
From:
Andy Dougherty
Date:
March 1, 2010 14:40
Subject:
Re: Another optimization question: bsearch()
Message ID:
alpine.DEB.2.00.1003011716240.14331@fractal.phys.lafayette.edu
On Mon, 1 Mar 2010, H.Merijn Brand wrote:

> On Mon, 01 Mar 2010 11:43:27 -0700, karl williamson
> <public@khwilliamson.com> wrote:
> 
> > Jarkko a long time ago that swashes and regex character classes should 
> > be replaced by inversion lists for efficiency.
> > 
> > Inversion lists can be searched binarily.  bsearch() is a standard C 
> > library routine, but the only mention of it in Perl is in the POSIX 
> > module where it says it is not furnished.  This makes me think there 
> > must be a problem with using the library routine.  Is there?
> 
> Seems to be available on both my oldest HP-UX as well as on my oldest
> AIX. Do you need a probe for it in Configure?

It's in my old SVR3 manuals too, though with a simpler prototype (char 
instead of void, and no const).  The "unimplemented" message has been 
there since perl 5.000.  I don't remember any specific problem with the 
function. I suspect it's unimplemented in POSIX.pm simply because it's 
never been a high enough priority for anyone to actually figure out how 
they'd like to map it into perl.

In short, if it makes sense to use it, I think you can go ahead and use 
it.

-- 
    Andy Dougherty		doughera@lafayette.edu

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