changeset 991:6a06014f7a38

generators: save a few percents in generated code size by generating denser padding.
author shade
date Tue, 02 Sep 2014 15:39:52 +0400
parents 239a7f170831
children e7f0bf479bcf
files jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java jmh-core/src/main/java/org/openjdk/jmh/generators/core/StateObjectHandler.java
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java	Tue Sep 02 15:24:13 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java	Tue Sep 02 15:39:52 2014 +0400
@@ -548,9 +548,9 @@
         for (int p = 0; p < 16; p++) {
             StringBuilder sb = new StringBuilder();
             sb.append(ident(1));
-            sb.append("private boolean p").append(p);
+            sb.append(String.format("boolean p%03d", p*16));
             for (int q = 1; q < 16; q++) {
-                sb.append(", p").append(p).append("_").append(q);
+                sb.append(String.format(", p%03d", p*16 + q));
             }
             sb.append(";");
             writer.println(sb.toString());
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/core/StateObjectHandler.java	Tue Sep 02 15:24:13 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/core/StateObjectHandler.java	Tue Sep 02 15:39:52 2014 +0400
@@ -802,9 +802,9 @@
     public static void padding(List<String> lines, String suffix) {
         for (int p = 0; p < 16; p++) {
             StringBuilder sb = new StringBuilder();
-            sb.append("    private boolean p").append(suffix).append("_").append(p);
+            sb.append("    boolean ").append(suffix).append(String.format("_%03d", p * 16));
             for (int q = 1; q < 16; q++) {
-                sb.append(", p").append(suffix).append("_").append(p).append("_").append(q);
+                sb.append(", ").append(suffix).append(String.format("_%03d", p*16 + q));
             }
             sb.append(";");
             lines.add(sb.toString());