-
Bug
-
Resolution: Fixed
-
P2
-
6
-
b90
-
x86
-
linux
NetBeans 5.0 running on Mustang build has performance regression on startup when compared to run on Tiger. The biggest of part of this can be narrowed to slower parsing of XML resources. In particular creating of XMLReader on Mustang is more exepensive than it was on Tiger because the JDK tries to read non-existing file <java.home>/lib/xerces.properties and also tries to load resource META-INF/services/com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration. When these attempts to find configuration of parser fail it uses fallback and creates default configuration for parser.
The test case for this that can be run on Linux:
------------------------
package xercestest;
import javax.xml.parsers.*;
import org.xml.sax.InputSource;
import java.io.StringReader;
import org.xml.sax.XMLReader;
// run as :
// strace -f java -cp build/classes xercestest.Main 2>&1 | grep 'stat('
// to see all the stat messages.
public class Main {
public static void main(String[] args){
new Main().run();
}
private XMLReader createXMLReader() throws Exception {
SAXParserFactory f = SAXParserFactory.newInstance();
XMLReader r = f.newSAXParser().getXMLReader();
return r;
}
public void run(){
String xml0 = "<?xml version='1.0'?><foo>Hello</foo>";
String xml1 = "<?xml version='1.0'?><foo>GutenMorgen</foo>";
String xml2 = "<?xml version='1.0'?><foo>Salvete</foo>";
try {
createXMLReader().parse(new InputSource(new StringReader(xml0)));
createXMLReader().parse(new InputSource(new StringReader(xml1)));
createXMLReader().parse(new InputSource(new StringReader(xml2)));
} catch (Exception e) {
System.out.println("Exception: " + e);
}
}
}
------------------------
This test shows repeated attempt to find resource META-INF/services/javax.xml.parsers.SAXParserFactory on JDK 1.5.0.
Using JDK 1.6.0b76 it tries to find resource META-INF/services/javax.xml.parsers.SAXParserFactory and also META-INF/services/com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration and to read xerces.propeties file from Java instalation.
The test case for this that can be run on Linux:
------------------------
package xercestest;
import javax.xml.parsers.*;
import org.xml.sax.InputSource;
import java.io.StringReader;
import org.xml.sax.XMLReader;
// run as :
// strace -f java -cp build/classes xercestest.Main 2>&1 | grep 'stat('
// to see all the stat messages.
public class Main {
public static void main(String[] args){
new Main().run();
}
private XMLReader createXMLReader() throws Exception {
SAXParserFactory f = SAXParserFactory.newInstance();
XMLReader r = f.newSAXParser().getXMLReader();
return r;
}
public void run(){
String xml0 = "<?xml version='1.0'?><foo>Hello</foo>";
String xml1 = "<?xml version='1.0'?><foo>GutenMorgen</foo>";
String xml2 = "<?xml version='1.0'?><foo>Salvete</foo>";
try {
createXMLReader().parse(new InputSource(new StringReader(xml0)));
createXMLReader().parse(new InputSource(new StringReader(xml1)));
createXMLReader().parse(new InputSource(new StringReader(xml2)));
} catch (Exception e) {
System.out.println("Exception: " + e);
}
}
}
------------------------
This test shows repeated attempt to find resource META-INF/services/javax.xml.parsers.SAXParserFactory on JDK 1.5.0.
Using JDK 1.6.0b76 it tries to find resource META-INF/services/javax.xml.parsers.SAXParserFactory and also META-INF/services/com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration and to read xerces.propeties file from Java instalation.