Repository: groovy
Updated Branches:
  refs/heads/master f5e63e577 -> 582ecf4e1


Increase the initial capacity of `StringBuilderWriter` for generating source


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/582ecf4e
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/582ecf4e
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/582ecf4e

Branch: refs/heads/master
Commit: 582ecf4e1b81fd666471d8d38ba808f05a52b555
Parents: f5e63e5
Author: sunlan <[email protected]>
Authored: Mon Jan 8 07:55:08 2018 +0800
Committer: sunlan <[email protected]>
Committed: Mon Jan 8 07:55:08 2018 +0800

----------------------------------------------------------------------
 .../src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/582ecf4e/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy
----------------------------------------------------------------------
diff --git 
a/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy
 
b/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy
index 09f9ec3..a3b42c8 100644
--- 
a/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy
+++ 
b/subprojects/groovy-console/src/main/groovy/groovy/inspect/swingui/AstBrowser.groovy
@@ -328,7 +328,7 @@ class AstBrowser {
     }
 
     private String generateSource(byte[] bytecode, getVisitor) {
-        def sw = new StringBuilderWriter()
+        def sw = new StringBuilderWriter(2048) // the generated code of 
`println 123` occupies about 618 bytes, so we should increase the initial 
capacity to 2K
         new ClassReader(bytecode).accept(getVisitor(sw), 0)
         return sw.toString()
     }

Reply via email to