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.
Summary: | Check performance impact of DOCTYPE in winsys config files | ||
---|---|---|---|
Product: | platform | Reporter: | mslama <mslama> |
Component: | Window System | Assignee: | mslama <mslama> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | anebuzelsky, jglick, jtulach, pnejedly, pzavadsky, rkubacki, ttran |
Priority: | P3 | Keywords: | PERFORMANCE |
Version: | 3.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | TASK | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 36917 |
Description
mslama
2003-10-29 12:43:53 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 } Please say what do you think: Add DOCTYPE or not? Or shall I do some other test with more files? Well if it's too slow, don't do it. 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. 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). 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. 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. 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. |