Skip site navigation (1) Skip section navigation (2)

Re: UTF8MatchText

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>, ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: UTF8MatchText
Date: 2007-05-20 19:45:54
Message-ID: 4650A572.2090109@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches

Tom Lane wrote:
> On the strength of this analysis, shouldn't we drop the separate
> UTF8 match function and just use SB_MatchText for UTF8?
>   

Possibly - IIRC I looked at that and there was some reason I didn't, but 
I'll look again.

> It strikes me that we may be overcomplicating matters in another way
> too.  If you believe that the %-scan code is now the bottleneck, that
> is, the key loop is where we have pattern '%foo' and we are trying to
> match 'f' to each successive data position, then you should be bothered
> that SB_MatchTextIC is applying tolower() to 'f' again for each data
> character.  Worst-case we could have O(N^2) applications of tolower()
> during a match.  I think there's a fair case to be made that we should
> get rid of SB_MatchTextIC and implement *all* the case-insensitive
> variants by means of an initial lower() call.  This would leave us with
> just two match functions and allow considerable unification of the setup
> logic.
>
> 	
>   


Yeah, quite possibly. I'm also wondering if we are wasting effort 
downcasing what will in most cases be the same pattern over and over 
again. Maybe we need to look at memoizing that somehow, or at least test 
to see if that would be a gain.

We're getting quite a long way from the original patch :-)

cheers

andrew

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2007-05-20 21:16:10
Subject: Re: [PATCHES] Full page writes improvement, code update
Previous:From: Andrew DunstanDate: 2007-05-20 19:39:23
Subject: Re: [PATCHES] build/install xml2 when configured with libxml

pgsql-patches by date

Next:From: Tom LaneDate: 2007-05-20 21:16:10
Subject: Re: [PATCHES] Full page writes improvement, code update
Previous:From: Andrew DunstanDate: 2007-05-20 19:39:23
Subject: Re: [PATCHES] build/install xml2 when configured with libxml

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group