(keitai-l) Re: open source keitai tools (was Re: Re: western phone, imode sit

From: Christian Molstrom <cmolstrom_at_lightsurf.com>
Date: 02/27/02
Message-ID: <002901c1bf36$c9ca92c0$6601a8c0@office.lightsurf.com>
> > ...but I wonder what performance difference there might
be
> > between (a) pulling the data straight from xml (probably
via SAX) and
> > (b) returning data from a getter method in an object.
>
> Massive. In the second case, you've got the data in an
object in
> memory, and you're just returning a base type or an object
reference.
> In the second you're doing parsing of strings (always
expensive),
> perhaps file I/O, and who knows what else. That's really
something
> you want to do only once, if you can manage it. In this
case we're
> dealing with quite a small amount of data, so it's not a
big deal.
> Even if it got as large as 2K/phone and we had 500 phones,
that's
> still only a megabyte of data.

The way I understand a few xml parsers implemented in
java -- okay DOM ones at least -- is that the xml file is
already represented as an object.  With the JDOM API, for
instance, you create an object that reads in your xml from
disk (one time operation), which then creates an xml
document object that resides in memory forever.   To get
your morsels, you simply query on elements and attributes in
the document object.  So I don't think you are condemned to
expensive string parsing.

OO method:
width = device_P503i.getDisplayWidth();

parser doc method:
width =
myDoc.getElement("P503i").getAttribute("display-width"); //
or whatever

Advantage of 1 is that we can guarantee performance since we
pretty much know the underlying operations here.  Plus it is
cleaner and simpler.  The speed of 2 really depends on the
xml parsing API, and ease of access depends on the
complexity of the xml document itself.

Christian
Received on Wed Feb 27 04:36:32 2002