Change bargull-20110320-sxH by bargull@Bargull02 on 2011-03-20 15:16:13
in /home/anba/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Boost performance of schema build process
Bugs Fixed: LPP-9841 (js2doc painfully slow due to massive internal
document copies)
Technical Reviewer: max
QA Reviewer: (pending)
Overview:
Java's built-in XPath support always converts the complete w3c.dom
document to its internal dtm format in every XPath evaluation. Detaching
the w3c.dom elements from the document prevents copying the complete
document. This is the main change dropping the execution time from >2
minutes to ~15 seconds, the other changes give less significant
improvements. Overall the execution time is now ~10 seconds.
Details:
SchemaBuilder:
- precompile all xpath expressions and provide some nicer interface to
retrieve the xpath results
#build(Element)
- detach element from document to avoid the expensive document copies
JS2DocUtils:
- save and reuse the DocumentBuilderFactory and TransformerFactory
Tests:
build lfc.schema, compare resulting schema file
Files:
M WEB-INF/lps/server/src/org/openlaszlo/js2doc/JS2DocUtils.java
M WEB-INF/lps/server/src/org/openlaszlo/js2doc/SchemaBuilder.java
Changeset:
http://svn.openlaszlo.org/openlaszlo/patches/bargull-20110320-sxH.tar