PQunescapeBytea tweak

Started by Adam Kavanover 22 years ago4 messagespatches
Jump to latest
#1Adam Kavan
akavan@cox.net

This patch converts PQunescapeBytea from using arrays to the text string
and to the output binary string to using pointers. This makes it much
faster than the older version for large Bytea's.

--- Adam Kavan
--- akavan@cox.net

Attachments:

fe-exec.patchapplication/octet-stream; name=fe-exec.patchDownload+18-21
#2Bruce Momjian
bruce@momjian.us
In reply to: Adam Kavan (#1)
Re: PQunescapeBytea tweak

Is this against 7.3.X or 7.4beta? Also, we prefer diff -c.

---------------------------------------------------------------------------

Adam Kavan wrote:

This patch converts PQunescapeBytea from using arrays to the text string
and to the output binary string to using pointers. This makes it much
faster than the older version for large Bytea's.

--- Adam Kavan
--- akavan@cox.net

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Adam Kavan (#1)
Re: PQunescapeBytea tweak

Adam Kavan <akavan@cox.net> writes:

This patch converts PQunescapeBytea from using arrays to the text string
and to the output binary string to using pointers. This makes it much
faster than the older version for large Bytea's.

What compiler and optimization settings are you using, and what is the
hardware platform? It seems strange to me that you would get any
noticeable speedup from this change. Most C compilers are supposed to
be reasonably smart about optimizing subscripted pointers.

Also, how about using tmpbuf as the moving pointer, instead of
interchanging the roles of tmpbuf and buffer as you did? That
seems a bit confusing.

Finally, as Bruce noted, we prefer diff -c output for patches.
It's safer to apply that way --- the plain diff format fails
too easily if there have been any nearby changes.

regards, tom lane

#4Adam Kavan
akavan@cox.net
In reply to: Tom Lane (#3)
Re: PQunescapeBytea tweak

At 09:57 PM 10/30/03 -0500, Tom Lane wrote:

What compiler and optimization settings are you using, and what is the
hardware platform? It seems strange to me that you would get any
noticeable speedup from this change. Most C compilers are supposed to
be reasonably smart about optimizing subscripted pointers.

Whoops, my code was linking against an old 7.3.x version of libpq, the
speed is the same compared to 7.4.

--- Adam Kavan
--- akavan@cox.net