mrglavas 2004/03/11 14:37:49 Modified: java/src/org/apache/xerces/dom ObjectFactory.java java/src/org/apache/html/dom ObjectFactory.java java/src/org/apache/xml/serialize ObjectFactory.java java/src/org/apache/xerces/xinclude ObjectFactory.java java/src/org/apache/xerces/parsers ObjectFactory.java java/src/org/apache/xerces/impl/dv ObjectFactory.java Log: Performance: to read the service provider name from a jar
we use a BufferedReader and read the first line from the file. BufferedReader's default buffer size is 8K chars. Since we're only reading one line this is pretty excessive. Reducing this size significantly. Revision Changes Path 1.4 +8 -3 xml-xerces/java/src/org/apache/xerces/dom/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ObjectFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ObjectFactory.java 24 Feb 2004 23:23:17 -0000 1.3 +++ ObjectFactory.java 11 Mar 2004 22:37:49 -0000 1.4 @@ -51,6 +51,11 @@ /** Set to true for debugging */ private static final boolean DEBUG = false; + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; + /** cache the contents of the xerces.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error @@ -426,9 +431,9 @@ // jkesselm] BufferedReader rd; try { - rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); } catch (java.io.UnsupportedEncodingException e) { - rd = new BufferedReader(new InputStreamReader(is)); + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); } String factoryClassName = null; 1.4 +8 -3 xml-xerces/java/src/org/apache/html/dom/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/html/dom/ObjectFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ObjectFactory.java 24 Feb 2004 23:34:01 -0000 1.3 +++ ObjectFactory.java 11 Mar 2004 22:37:49 -0000 1.4 @@ -50,6 +50,11 @@ /** Set to true for debugging */ private static final boolean DEBUG = false; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; /** cache the contents of the xerces.properties file. * Until an attempt has been made to read this file, this will @@ -426,9 +431,9 @@ // jkesselm] BufferedReader rd; try { - rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); } catch (java.io.UnsupportedEncodingException e) { - rd = new BufferedReader(new InputStreamReader(is)); + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); } String factoryClassName = null; 1.4 +8 -3 xml-xerces/java/src/org/apache/xml/serialize/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/ObjectFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ObjectFactory.java 24 Feb 2004 23:34:03 -0000 1.3 +++ ObjectFactory.java 11 Mar 2004 22:37:49 -0000 1.4 @@ -50,6 +50,11 @@ /** Set to true for debugging */ private static final boolean DEBUG = false; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; /** cache the contents of the xerces.properties file. * Until an attempt has been made to read this file, this will @@ -426,9 +431,9 @@ // jkesselm] BufferedReader rd; try { - rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); } catch (java.io.UnsupportedEncodingException e) { - rd = new BufferedReader(new InputStreamReader(is)); + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); } String factoryClassName = null; 1.3 +8 -3 xml-xerces/java/src/org/apache/xerces/xinclude/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xinclude/ObjectFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ObjectFactory.java 24 Feb 2004 23:15:52 -0000 1.2 +++ ObjectFactory.java 11 Mar 2004 22:37:49 -0000 1.3 @@ -51,6 +51,11 @@ /** Set to true for debugging */ private static final boolean DEBUG = false; + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; + /** cache the contents of the xerces.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error @@ -426,9 +431,9 @@ // jkesselm] BufferedReader rd; try { - rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); } catch (java.io.UnsupportedEncodingException e) { - rd = new BufferedReader(new InputStreamReader(is)); + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); } String factoryClassName = null; 1.4 +8 -3 xml-xerces/java/src/org/apache/xerces/parsers/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/ObjectFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ObjectFactory.java 24 Feb 2004 23:15:56 -0000 1.3 +++ ObjectFactory.java 11 Mar 2004 22:37:49 -0000 1.4 @@ -50,6 +50,11 @@ /** Set to true for debugging */ private static final boolean DEBUG = false; + + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; /** cache the contents of the xerces.properties file. * Until an attempt has been made to read this file, this will @@ -426,9 +431,9 @@ // jkesselm] BufferedReader rd; try { - rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); } catch (java.io.UnsupportedEncodingException e) { - rd = new BufferedReader(new InputStreamReader(is)); + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); } String factoryClassName = null; 1.4 +8 -3 xml-xerces/java/src/org/apache/xerces/impl/dv/ObjectFactory.java Index: ObjectFactory.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/ObjectFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ObjectFactory.java 24 Feb 2004 22:44:26 -0000 1.3 +++ ObjectFactory.java 11 Mar 2004 22:37:49 -0000 1.4 @@ -51,6 +51,11 @@ /** Set to true for debugging */ private static final boolean DEBUG = false; + /** + * Default columns per line. + */ + private static final int DEFAULT_LINE_LENGTH = 80; + /** cache the contents of the xerces.properties file. * Until an attempt has been made to read this file, this will * be null; if the file does not exist or we encounter some other error @@ -426,9 +431,9 @@ // jkesselm] BufferedReader rd; try { - rd = new BufferedReader(new InputStreamReader(is, "UTF-8")); + rd = new BufferedReader(new InputStreamReader(is, "UTF-8"), DEFAULT_LINE_LENGTH); } catch (java.io.UnsupportedEncodingException e) { - rd = new BufferedReader(new InputStreamReader(is)); + rd = new BufferedReader(new InputStreamReader(is), DEFAULT_LINE_LENGTH); } String factoryClassName = null; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]