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

Re: Another optimization question: bsearch()

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
March 3, 2010 05:48
Subject:
Re: Another optimization question: bsearch()
Message ID:
20100303134745.GP43146@plum.flirble.org
On Mon, Mar 01, 2010 at 04:45:57PM -0700, karl williamson wrote:
> 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 

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

That's my view too.

> 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.

Something I've been thinking for a while is that (to my mind) it would be good
if the Unicode structures for the regexp engine weren't run time loaded, and
stored in "Perl" data structures.

If they were instead built as const static C data structures, much like the
tables used by Encode, then they could be linked into perl at build time.
This would mean

1: Zero load time
2: (likely) faster runtime lookup
3: implicitly shared between perl processes (on most OSes)

Nicholas Clark

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