Re: invalidly encoded strings - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: invalidly encoded strings
Date
Msg-id 46E3DD0B.6080900@dunslane.net
Whole thread Raw
In response to Re: invalidly encoded strings  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers

Martijn van Oosterhout wrote:
> On Sun, Sep 09, 2007 at 12:02:28AM -0400, Andrew Dunstan wrote:
>   
>> . what do we need to do to make the verification code more efficient? I 
>> think we need to address the correctness issue first, but doing so 
>> should certainly make us want to improve the verification code. For 
>> example, I'm wondering if it might benefit from having a tiny cache.
>>     
>
> It has been pointed out the the verification for UTF-8 is very
> inefficient, involving several function calls to first get the length,
> then check characters, etc. It could be significantly improved. I don't
> know whether a cache would make any useful difference.
>
>
>   

Well, it looks to me like "several" = 2. If function call overhead is 
the worry, we could either create inline versions of pg_utf_mblen and 
pg_utf8_islegal and rely on the compiler to make things good for us, or 
inline the calls directly ourselves. Either way there's some 
duplication, since the whole "extern inline" thing is still a mess. I'd 
be inclined to do the inlining by hand since it's not that much code and 
it would be more portable. Unless I'm missing something it should be a 
10 minute c&p job.

Is that all we're worried about?

cheers

andrew


pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: invalidly encoded strings
Next
From: Tom Lane
Date:
Subject: Re: invalidly encoded strings