Re: new String(byte[]) performance

From: Aaron Mulder <ammulder(at)alumni(dot)princeton(dot)edu>
To: PostgreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: new String(byte[]) performance
Date: 2002-10-22 17:34:15
Message-ID: Pine.LNX.4.44.0210221325330.13643-100000@www.princetongames.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, 22 Oct 2002, Barry Lind wrote:
> That is correct. The FE/BE protocol sends the data back and forth as
> strings for all the data types. The only exception to this is if you
> are using a 'binary cursor' inwhich case the data is sent in binary,
> (however the byte order is platform dependent, which makes it a pain to
> use binary cursors).

I think it would be less of a pain to deal with byte
order/endianness than to constantly decode text into numbers. I mean,
we'd use one routine to read all ints/floats/etc., and it's not hard to
have a flag for whether to read abcd or dcba before we stuff it into an
int/float/whatever. Java even has the methods to do this (see DataInput
JavaDoc, Float.intBitsToFloat, etc.) All we need is some indicator of the
native byte order of the server, which could be achieved by sending a
single well-known number in the connection process (you know, the
byte-level analog of "did the server report version 7.3 or 3.7?").
Truly, one flag for endianness vs creating extra objects for every
numeric value ever read from the server, and getting bugs like can't read
"" as an integer? Which is really the pain?

Not that you probably wanted me to agitate for architecture
changes during the beta process... :)

Aaron

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-10-22 17:40:29 Re: new String(byte[]) performance
Previous Message Teofilis Martisius 2002-10-22 17:19:24 Re: new String(byte[]) performance