This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 36887 - Check performance impact of DOCTYPE in winsys config files
Summary: Check performance impact of DOCTYPE in winsys config files
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: mslama
URL:
Keywords: PERFORMANCE
Depends on:
Blocks: 36917
  Show dependency tree
 
Reported: 2003-10-29 12:43 UTC by mslama
Modified: 2008-12-22 15:45 UTC (History)
7 users (show)

See Also:
Issue Type: TASK
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mslama 2003-10-29 12:43:53 UTC
DOCTYPE was not saved in window system
configuration files to improve parser speed. It
would good to check what is current impact of this
change. (If we would add DOCTYPE.)
Comment 1 mslama 2003-12-03 15:07:02 UTC
I made simple test on my Linux RH 8, JDK 1.4.2_02, current dev build.
My configuration contains default winsys config:
WindowManager, 3 wsgrp, 14 wstcgrp, 7 wsmode, 19 wstref files = total
48 XML files to be parsed in one pass. I added simple method to
PersistenceManager just to load/parse these files (calls
WindowManagerParser.load). Simple test makes 100 calls (ie. 100 passes
of parsing 49 files total 4900 files is repeatedly parsed in one test)
of that in one test, made 10 times and with DOCTYPE in XML files
parsing is about 23% longer. I think it is good reason NOT to put
doctypes to XML files even if one parsing of all configuration files
takes about 100ms so it does not add too much to startup time. (But it
can change when number of XML configuration files grows.)

Of course parsers are configured to return empty InputSource:
        /** Implementation of entity resolver. Points to the local DTD
         * for our public ID */
        public InputSource resolveEntity (String publicId, String
systemId)
        throws SAXException {
            if (INSTANCE_DTD_ID_1_0.equals(publicId)
             || INSTANCE_DTD_ID_1_1.equals(publicId)
             || INSTANCE_DTD_ID_2_0.equals(publicId)) {
                InputStream is = new ByteArrayInputStream(new byte[0]);
                return new InputSource(is);
            }
            return null; // i.e. follow advice of systemID
        }

Comment 2 mslama 2003-12-03 15:22:10 UTC
Please say what do you think: Add DOCTYPE or not? Or shall I do some
other test with more files?
Comment 3 Jesse Glick 2003-12-03 15:27:55 UTC
Well if it's too slow, don't do it.
Comment 4 Jesse Glick 2003-12-03 15:29:45 UTC
As an aside, I would be interested in whether using namespaces rather
than DTDs to distinguish XML document types would solve this kind of
problem for the future. Anyway under real Registry all such files
would just be fragments of one big document probably cached in a
binary database.
Comment 5 _ rkubacki 2003-12-03 15:39:30 UTC
It is hard to judge what is better. How much do we earn with DOCTYPE?

Marek's test include a lot of compilations I guess so the results can
be distorted. Maybe test with more complex UI can give us another
usefull numbers (Tonda already did some measuring and we are going to
automate such test).
Comment 6 Jesse Glick 2003-12-03 15:58:08 UTC
Well don't spend too long on it; should be considered more like P4 or
P5. The only benefit is clearly identifying the intended structure of
each file you save. Doesn't have any runtime benefit.
Comment 7 mslama 2003-12-03 16:11:12 UTC
I tested more complex case 116 components in editor so about 130 XML
total. Result is the same: about 23% longer with DOCTYPE.

To be clear: We talk about XML config files saved by winsys to local
folder (customized data) NOT about files which are defined in modules.
(Files from modules influence only first user start. When IDE is
exited all config XML files are now stored to user dir to folder
Windows2Local. So question is if these files stored by winsys should
contain DOCTYPE or not.)

For module files it is reasonable because module developer can
validate what he creates. In case of files saved by winsys there is no
such advantage. Winsys saves/loads these files and does no validation
anyway. So I think it is better not to put DOCTYPE to these files.
Comment 8 mslama 2003-12-05 14:11:26 UTC
Conclusion is: With DOCTYPE parsing is about 20% slower. If there is
some advantage to offset this overhead I can add DOCTYPE to winsys
configuration XML files.