[jdom-interest] a question about node type

Elliotte Harold elharo at metalab.unc.edu
Thu Dec 7 05:05:11 PST 2006

Syloke Soong wrote:
> [quote]
> instanceof is reflection and reflection is slow :).
> [/quote]
> Omg[osh], I've got instanceof operator all over the place. Though it
> seems my IO operations that are slowing my apps down.

Then your I/O operations are pretty damn slow. :-)

In my profiling in another project, the one guarantee was that any 
method that called instanceof was a performance sink. If it was used in 
a loop it was even worse. I went to great lengths internally to almost 
completely eliminate instanceof from my code.

Plus, instanceof is usually an indication of failure of the object 
model. Polymorphism should normally replace instanceof and similar 
checks, though you can't always do that when working with other people's 

Elliotte Rusty Harold  elharo at metalab.unc.edu
Java I/O 2nd Edition Just Published!

More information about the jdom-interest mailing list