From: | tgl(at)postgresql(dot)org (Tom Lane) |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix performance issues in replace_text(), replace_text_regexp(), |
Date: | 2006-11-08 19:22:25 |
Message-ID: | 20061108192225.371439FB26B@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Log Message:
-----------
Fix performance issues in replace_text(), replace_text_regexp(), and
text_to_array(): they all had O(N^2) behavior on long input strings in
multibyte encodings, because of repeated rescanning of the input text to
identify substrings whose positions/lengths were computed in characters
instead of bytes. Fix by tracking the current source position as a char
pointer as well as a character-count. Also avoid some unnecessary palloc
operations. text_to_array() also leaked memory intracall due to failure
to pfree temporary strings. Per gripe from Tatsuo Ishii.
Modified Files:
--------------
pgsql/src/backend/utils/adt:
varlena.c (r1.152 -> r1.153)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/varlena.c.diff?r1=1.152&r2=1.153)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-11-08 19:24:38 | pgsql: Tweak accumArrayResult() to double the size of its working arrays |
Previous Message | Neil Conway | 2006-11-08 19:06:15 | pgsql: Fix two typos. |