Re: Reading the WKB format in Java

From: Ken Anderson <kanderson@bbn.com>
Date: Tue Jul 02 2002 - 18:22:08 EDT

Fair enough, however, lets estimate the difference in performance between
binary and text. Say you have two data types mostly, String and Double (or
double). String where each character is a byte is basically what you'd get
if you used the normal byte/character encoding or some fancy UTF encoding.
You could represent a float in 4 bytes, a double in 8 if it is binary.
In the worst case, you could print the double representation in about 17
characters. This is 2.125 times more characters that need to be processed.
In the binary version you need to some kind of shift and or for each byte,
say 2 instructions. For the text version you need to do a multiply an add
and a subtraction, say 3. So the binary case is 8*2 = 16, and the worst
text case is 17*3 = 51. So the worst case is 51/16 = 3.1875 slower.

This may not be too bad.
In extreme programming, they say "do the simplest thing that might work".
It might be worth seeing how long a factor of 3 will work for you.

k

At 05:33 PM 7/2/2002, David Garnier wrote:
>On Tue, 02 Jul 2002 16:43:32 -0400
>Ken Anderson <kanderson@bbn.com> wrote:
>
> > If your could send me some examples of the text that you need to parse, i
> > could see if i can write it without consing strings.
> >
> > k
>
>Here is the trick: my applications has very high performance requirements,
>and I really want to avoid any overheads in the design. I really don't
>think that string parsing can beat direct binary conversion (as in
>DataOutputStream).
>
>When this will be done, users will be able to get OMGraphics from a
>PostGIS DB at blazzing speeds.
>
>By the way, thanks for working on OpenMap. That's a great tool.
>
>Best Regards,
>David Garnier
>
> > At 05:53 PM 7/2/2002, you wrote:
> >
> > >Hello,
> > >I'm looking for a free (as in freedom) WKBReader
> > >written in Java i.e. a class that would take an array of bytes in the
> > >Well-Known-Binary format specified by the OpenGIS consortium
> > > and turn in into a geometry object of some kind, or at least an
> array of
> > > floats or doubles. I searched to web, to no avail. Do you know of/have
> > > written such a thing?
> > >
> > >Background:
> > >I'm trying to make OpenMap work with PostGIS (a very fine spatial
> > >extension to PostgreSQL, check it out at http://
> > >postgis.refractions.net/). The problem is that right now the only way to
> > >extract the coordinates is to use the WKT format (a text representation)
> > >and then parse the output. This involves a huge overhead due to the large
> > >number of String allocations. If I need to write my own, it will be as
> > >geographical-toolkit agnostic as possible, meaning that the design of the
> > >reader won't lock you into one geographical toolkit.
> > >
> > >Best Regards,
> > >David Garnier
> > >
> > >PS: This message was posted to several mailing-lists related to
> > >open-source geographical information system in Java. Sorry if you get
> > >several copies.
> > >
> > >--
> > >[To unsubscribe to this list send an email to "majdart@bbn.com"
> > >with the following text in the BODY of the message "unsubscribe
> > >openmap-users"]
> >
> >

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Jul 2 18:22:44 2002

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:33 EDT