[jdom-interest] Ampersand question
tsasala at hifusion.com
tsasala at hifusion.com
Fri Jul 14 04:15:59 PDT 2000
Alex Chaffee wrote:
>
> All I meant was that java.sql.Blob.getBinaryStream() returns an
> InputStream. (I'm not sure how it's implemented behind the scenes by
> drivers.) I was imagining XML being stored directly in the DB, since
> I think you mentioned blobs at one point.
Actually, *you* mentioned blobs ;) We're stuck with Sybase.
>
> Without looking in detail at your architecture, I'm not sure how much
> it applies, but my main point was, try to eliminate middle steps. If
> you have, e.g., code that turns a result set into an XML string, then
> more code that turns the XML string into a JDOM tree, then it would be
> more efficient to have code that turns the ResultSet into a JDOM tree directly.
>
> Barring that (and I think you did bar that by saying "this is not my
> choice"), the next best thing would be to make sure when building your
> string to make liberal use of StringBuffer.append rather than making
> individual strings and then later StringBuffer.appending them together
> (this happens when using +). Each new string gets (a) copied, wasting
> time, and (b) abandoned in the heap, wasting a little space, requiring
> GC to happen more frequently, and making the heap more fragmented when
> GC is done, which increases the memory footprint of the app.
The vast majority of our work is done with the JDOM object
and only persisted as a string. But these are good points to note
for the future.
-Tom
More information about the jdom-interest
mailing list