[jdom-interest] XMLOutputter.isWhiteSpace

David D. Lucas ddlucas at lse.com
Wed May 1 05:58:10 PDT 2002


Looks as though only the isWhitespace is running faster.
The other two escapeXXXEntities seem to be a wash.  I guess the 
difference has to do with the Java Runtime inside a profiler and the raw 
performance tests of iterating 1,000,000 times to see how a hotspot or 
JIT handle that method.


One thing that was significant for the hotspot/jit out there, by making 
the private method on isWhitespace "final" it boost the performance 
about 20%.  Now I thought that private was an implied final because no 
one can extend the class and implement the private method, but 
apparently it is symetric with the other access levels on methods and 
somehow must get an entry in the virtual table.

I am still testing my latest changes to XMLOutputter.  Once I am done, 
who or what do you want me to give/do with the code?

I have another question on Element and lazy creation I will post in a 
seperate thread.

Thanks,
Dave


Alex Rosen wrote:

>>Does the isWhitespace method contain any sensitive string encoding in
>>the way it uses the 4 whitespace markers and the indexof?
>>The indexof method is very speed prohibitive.
>>I can do the same thing using char comparisons and it will yeild about
>>10X performance increase.  This adds up with big messages.  I guess the
>>question is how does the 16bit characters react to literals like '\t'
>>compared to "\t" Strings.  I don't see any gotchas.  What does everyone
>>else think?
>>
> 
> Sounds good to me. There shouldn't be any difference between looking for
> '\t' as a char or "\t" in a String. "\t".charAt(0) == '\t'.
> 
> 
>>If you want to take a look at escapeElement, there is also some
>>improvement if we not add a character every loop, but add chunks of
>>data.  This probably applies to escapeAttribute.
>>
> 
> Also seems like a good idea, though probably less of a difference.
> 
> Alex
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> 
> 


-- 

+------------------------------------------------------------+
| David Lucas                        mailto:ddlucas at lse.com  |
| Lucas Software Engineering, Inc.   (740) 964-6248 Voice    |
| Unix,Java,C++,CORBA,XML,EJB        (614) 668-4020 Mobile   |
| Middleware,Frameworks              (888) 866-4728 Fax/Msg  |
+------------------------------------------------------------+
| GPS Location:  40.0150 deg Lat,  -82.6378 deg Long         |
| IMHC: "Jesus Christ is the way, the truth, and the life."  |
| IMHC: "I know where I am; I know where I'm going."    <><  |
+------------------------------------------------------------+

Notes: PGP Key Block=http://www.lse.com/~ddlucas/pgpblock.txt
IMHO="in my humble opinion" IMHC="in my humble conviction"
All trademarks above are those of their respective owners.





More information about the jdom-interest mailing list