title: javax.xml.validation.Validator very slow since JRE6 update 24?
body: <p>We hit an issue that the XML validator present in Java JRE got very slow in JRE 1.6u24 and this is present even in the most recent update.</p>
  
  <p>Validating 1000 XMLs takes for us:</p>
  
  <p>~1.4 seconds for version &lt;= 1.6u23;
  ~15.2 seconds for versions >= 1.6u24</p>
  
  <p>Which is 10 times slower! I tried to search if anyone found the issue already, but I can't find anything. </p>
  
  <p>We can of course workaround it by using another library like woodstox, but we would prefer pure JRE and I can't believe this could be there for such a long time without any improvement being made...</p>
  
  <p>The code we test looks like this:</p>
  
  <pre><code>public static void main(String[] args) throws XMLStreamException, SAXException, IOException, ParserConfigurationException {
      SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
      Schema schema = factory.newSchema(new Source[] {
              new StreamSource(new File("schema1.xsd")),
              new StreamSource(new File("schema2.xsd")) });
  
      Validator validator = schema.newValidator();
      XMLInputFactory staxFactory = XMLInputFactory.newInstance();
      String xml = FileUtils.readFileToString(new File("to_validate.xml"), "UTF-8");
  
      Date start = new Date();
      for (int i = 0; i &lt; 1000; i++) {
          XMLStreamReader xmlr = staxFactory.createXMLStreamReader(new StringReader(xml));
          StAXSource ss = new StAXSource(xmlr);
          validator.validate(ss);
      }
      Date end = new Date();
  
      System.out.println("seconds needed: " + (end.getTime() - start.getTime()) / 1000f);
  }
  </code></pre>