@Grab(group='org.gperfutils', module='gbench', version='0.4.3-groovy-2.4') String a = 'The quick brown fox' String b = 'jumps over the lazy dog' int x = 1 double y = 2 benchmark { 'simple concat' { String concat = a + ' ' + b + ' ' + x + ' ' + y } 'gstring' { String concat = "$a $b $x $y" } 'gstring (closures)' { String concat = "${-> a} ${-> b} ${-> x} ${-> y}" } 'StringBuilder' { String concat = new StringBuilder() .append(a).append(' ').append(b).append(' ').append(x).append(' ').append(y) } }.prettyPrint()