groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Increase the initial capacity of `StringBuilderWriter` for generating source
Date Mon, 08 Jan 2018 01:40:53 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X d5312b7e5 -> a0f503a7a


Increase the initial capacity of `StringBuilderWriter` for generating source

(cherry picked from commit 582ecf4)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: a0f503a7a770ef540fd4a997216342f3c49140cc
Parents: d5312b7
Author: sunlan <sunlan@apache.org>
Authored: Mon Jan 8 07:55:08 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Mon Jan 8 09:40:45 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/a0f503a7/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()
     }


Mime
View raw message