db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lance Eason" <lance.ea...@whisperwire.com>
Subject RE: Some performance tuning changes
Date Sun, 25 May 2003 01:53:15 GMT
Yeah, I'll take a look at the RowReader mods.

-----Original Message-----
From: Armin Waibel [mailto:armin.waibel@code-au-lait.de]
Sent: Saturday, May 24, 2003 7:02 PM
To: OJB Developers List
Subject: Re: Some performance tuning changes


Hi all, Lance

I currently checked in more stuff
of Lance's improvements. But there are still
outstanding proposals - see below.
These changes enhance performance of the
PB-api about unbelievable10%.

> 8) SqlHelper.cleanPath calls splitPath.  This results in lots of
> PathInfo objects being created needlessly and immediately discarded
> because cleanPath is only interested in the column portion.  I changed
> it to directly calculate the column portion itself and to avoid two
> indexOf operations in both cleanPath and splitPath when unnecessary.
>
> Files modified:
>    SqlHelper - optimized cleanPath and splitPath
>

Checked in CVS.
Jakob could you please review these changes.


> 1) RowReaderDefaultImpl retrieves values from the result set
> via column
> name instead of column index.  This quickly showed up as a hotspot in
> the profiler.  While it's definitely a lot more robust to use the name
> instead of the index there's no reason to pay the overhead of the name
> lookup (which is significant) on each and every row.  The names can be
> converted to indices once up front using
> ResultSet.findColumn(name) and
> then values can be retrieved by index for each row.  Since the same
> RowReader may service multiple RsIterators at the same time and
> different RsIterators may have different indices for the same column,
> the indices have to be local to the RsIterator somehow.  I went with a
> sort of cookie approach where the RsIterator asks the
> RowReader to index
> the columns and then hands that index back to the RowReader on the
> readObjectArrayFrom method.  So I added two method signatures to
> RowReader:
>
>     public int[] index(ResultSet rs);
>     public void readObjectArrayFrom(ResultSet rs, int[]
> index, Map row);
>
> and changed RowReaderDefaultImpl, RsIterator and SqlBasedRsIterator
> appropriately.  The other alternative would have been to instantiate a
> RowReader for each RsIterator and keep this information inside the
> RowReader itself, but that instantiation would have had a
> cost as well.
> I left the original readObjectArrayFrom() signature as well
> and left the
> PersistenceBroker.getObjectByIdentity() path using it since for single
> item queries there is probably a very small performance
> advantage to the
> original method.
>
> Files modified:
>    RowReader - added methods index and readObjectArrayFrom w/ index
>    RowReaderDefaultImpl - implemented index and readObjectArrayFrom w/
> index
>    RsIterator - call RowReader to build index for ResultSet in
> constructor and call new readObjectArrayFrom
>    SqlBasedRsIterator - call RowReader to build index for ResultSet in
> constructor
>

Lance, I don't get this work without failures running the test suite.
Don't know what's going wrong. Could you check this stuff against
the current CVS?

>
> 5, 6 and 7) PersistenceBrokerImpl is creating iterators to iterate
> through Vectors returned from ClassDescriptor methods.  I
> changed it to
> get elements by index instead (which is significantly faster).  Even
> better would be if the ClassDescriptor methods returned arrays of the
> appropriate type instead of Vectors (this would be more
> consistent with
> the rest of the ClassDescriptor interface as well as performing better
> and being more type-safe), but this would've required an interface
> change to ClassDescriptor.
>
> Files modified:
>    PersistenceBrokerImpl - replaced iterators with get elements by
> index,
still outstanding

> Also a lot of logger.debug messages were added to
> getRsIteratorFromQuery
> that are doing String concatenations.  I protected all these
> calls with
> logger.isDebugEnabled() checks.
>
done

> When returning a collection proxy PersistenceBrokerImpl/ProxyHelper
> always looks up the constructor again each time though the
> answer never
> changes.  I changed it to remember the constructors and use those
> instead of looking up the constructors from the classes each time.
>
> remembered proxy collection constructors and protected
> logger.debug messages
>    ProxyHelper - remember constructors for standard proxy collections
>
Changes in ProxyHelper are done.
Jakob could you please review these changes.

regards,
Armin




---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message