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)

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to