You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
|---|
|
From: Kees K. <kee...@xs...> - 2002-10-13 14:30:05
|
Hello,
I ran into some performance problems when using Domify with Xalan.
I have a bean "RegistrationMonth".
This bean has the methods :
- String getMonth()
- RegistrationBatch[] getBatches();
I queried the "RegistrationMonth" with the XPath
"RegistrationMonth/item[month='January']".
I noticed that Domify also executed the method "getBatches()". (Xalan
searches all children
in search of the month-element)
This is an expensive method in my application and Xalan will do nothing
with the content ! It
only wants the name !
So I decided to take a look at Domify and try to separate the MetaData
(the name) and the
content (the beans). In order to get the metadata we don't need to get
the content !
The trick is to initialize the variable wrapped (in ElementAdapter.java)
as late as possible.
(Not when instantiating an ElementAdapter, but when accessing content !)
It was easy to do. I managed to do it with a bit of refactoring.
1. I made the object 'wrapped' private in ElementAdapter.java
2. I made a method getWrapped() and setWrapped() in ElementAdapter.java.
3. All access to the variable wrapped was replaced by calls to
getWrapped() and
setWrapped(). (Files: ElementAdaper.java,
MapEntryElementAdapter.java, TypedElementAdapter.java)
4. I created a new Constructor for the ElementAdapter.java.
The constructor needs the arguments "parentOfWrapped" and
"methodToCreateWrapped". (It
doesn't need the argument "wrapme" anymore).
5. I enhanced the getWrapped() method to work with the newly created
Constructor.
The method 'getWrapped()' will instantiate the wrapped-variable if
"wrapped" is not set and
"parentOfWrapped" and "methodToCreateWrapped" is set.
Until now nothing really has changed the working of domify .
6. I replaced the Constructor of ElementAdapter in the method
"ElementAdapter.item(int index)" to
the newly created one. This method also created through reflection
the 'wrapped'-variable for
the old constructor. That was removed.
Ready !
The change was remarkable. My application is flying now !
(NB: I'm using Xalan2.0 because Xalan 2.2 and Xalan 2.4 have major
perfomance problems)
I attach all the changed files and hope somebody can put it in CVS.
Best Regards,
Kees Kuip.
The object wrapper in
This is what I did :
Domify instantiates
I have made Domify even more lazier than it is right now.
|