EUC_JP and SJIS conversion improvement

From: Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp>
To: pgsql-patches(at)postgresql(dot)org
Subject: EUC_JP and SJIS conversion improvement
Date: 2005-06-13 13:15:14
Message-ID: PIEMIKOOMKNIJLLLBCBBMEFBCIAA.a_ogawa@hi-ho.ne.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


The character-code conversion from EUC_JP to SJIS is executed by
converting two stages. The first stage is conversion from EUC_JP to MIC.
The next stage is conversion from MIC to SJIS. (Conversion from SJIS to
EUC_JP is also similar.)

It is not so efficient, because it is necessary to allocate the
buffer for MIC, and to execute the calculation for conversion twice.

In the attached patch, it enables the direct conversion of EUC_JP and
SJIS. Additionally, there is an improvement that reduce the call of
pg_mic_mblen.

The effect of the patch that I measured is as follows:

o The Data for test was created by 'pgbench -i'.

o Test SQL:
set client_encoding to 'SJIS';
select * from accounts;

o Test results: Linux(CPU: Pentium III, Compiler option: -O2)
- original: 2.920s
- patched : 2.278s

regards,

---
Atsushi Ogawa

Attachment Content-Type Size
euc_jp_and_sjis.patch application/octet-stream 6.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Abhijit Menon-Sen 2005-06-13 14:09:40 Re: creating WITH HOLD cursors using SPI
Previous Message Tino Wildenhain 2005-06-13 12:34:26 Re: The Contrib Roundup (long)

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-06-13 14:08:33 Re: plpgsql raise - parameters can be expressions
Previous Message Neil Conway 2005-06-13 12:01:04 Re: plpgsql raise - parameters can be expressions