Re: invalidly encoded strings

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: invalidly encoded strings
Date: 2007-09-09 11:46:19
Message-ID: 46E3DD0B.6080900@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-09-09 14:51:39 Re: invalidly encoded strings
Previous Message Martijn van Oosterhout 2007-09-09 10:59:45 Re: invalidly encoded strings

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-09-09 11:55:06 Re: HOT patch - version 15
Previous Message Martijn van Oosterhout 2007-09-09 10:59:45 Re: invalidly encoded strings