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

Re: Another optimization question: bsearch()

Thread Previous | Thread Next
From:
karl williamson
Date:
March 1, 2010 15:46
Subject:
Re: Another optimization question: bsearch()
Message ID:
4B8C51B5.8070708@khwilliamson.com
Andy Dougherty wrote:
> 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.
> 
That made me curious.  I have an SVR2 manual from 1983, and it's in 
there, with char*.  I think the void* and const constructs were added 
after that.  They're not in K&R 1st edition, but are in the 2nd, 1988. 
Anyway, I doubt that we'd need a Configure probe, and this is not a 
short term project; I'm just thinking ahead about the possibilities.

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