Approved! On 2011-03-27, at 12:07, André Bargull wrote:
> Change bargull-20110327-rCm by bargull@Bargull02 on 2011-03-27 17:45:28 > in /home/anba/src/svn/openlaszlo/trunk > for http://svn.openlaszlo.org/openlaszlo/trunk > > Summary: Replace StringWriter with StringBuilder in ScriptCompiler > > Bugs Fixed: LPP-9736 (Clean up java sources) (partial) > > Technical Reviewer: ptw > QA Reviewer: (pending) > > Details: > StringWriter uses StringBuffer internally, StringBuffer is synchronized for > use in multiple threads. Java5's new StringBuilder provides the same > functionality as StringBuffer, but safes the synchronization overhead. That > means StringBuilder should be preferred over StringBuffer/StringWriter. > > ScriptCompiler: > #writeObject(Object, Appendable) > -- changed second parameter from Writer to Java5 Appendable > -- this allows to use Writers as well as faster alternatives, e.g. > StringBuilder (Writer implements Appendable) > #isIdentifier(String) > -- use hashset instead of slower string comparison > #quote(String), #JSONquote(String) > -- code was almost the same, except for quote character selection in quote() > and slash character escaping in JSONquote() > -- quoteInternal() is now used for quoting, quote() and JSONquote() use this > new method internally > #quoteInternal(String, char, boolean) > -- new method for quoting, works for Javascript- and JSON-quoting > -- uses StringBuilder instead of StringReader+StringWriter > > CanvasCompiler, DebugCompiler, NodeModel, StyleSheetCompiler: > - use StringBuilder instead of StringWriter > > Tests: > > Files: > M WEB-INF/lps/server/src/org/openlaszlo/sc/ScriptCompiler.java > M WEB-INF/lps/server/src/org/openlaszlo/compiler/CanvasCompiler.java > M WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java > M WEB-INF/lps/server/src/org/openlaszlo/compiler/DebugCompiler.java > M WEB-INF/lps/server/src/org/openlaszlo/compiler/StyleSheetCompiler.java > > Changeset: > http://svn.openlaszlo.org/openlaszlo/patches/bargull-20110327-rCm.tar >
