title: Does using a jaxb XMLAdapter affect performance?
body: <p>I am unmarshalling a very large XML file using JAXB with an XMLAdapter used to unmarshal one particualar "problem" class. The XMLAdapter is fairly simple, but it is called many times - we are anticipating up to 2 Million times for a single xml file. Our test file is smaller - the adapter is called 200,000 times - but we are noticing a performance hit.  The adapter is fairly standard:</p>
  
  <pre><code>public class MyAdapter extends XmlAdapter&lt;Object, AdaptedClass&gt; {
  
    public static final String ATTRIBUTE_HREF = "href";
  
    public AdaptedClass unmarshal(Object obj) throws Exception {
  
    Element element = null;
  
    if (obj instanceof Element) {
  
        element = (Element)obj;
        String id = element.getAttribute(ATTRIBUTE_HREF);
        AdaptedClass pr = new AdaptedClass();
        pr.setHref(id);                           
        return pr;
    } 
   }
  </code></pre>
  
  <p>My question: Is there overhead in using an adapter? Does, for example, the adapter itself have to be looked up from a table? Could the code inside the adatper slow things down? In my case, the code is fairly simple, so its seems that some similar unmarshalling code would be taking place even if I weren't using the adapter..</p>