Created
January 17, 2015 21:54
-
-
Save bsideup/74f3ea8a16f96ecbf5dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CompilerConfiguration configuration = new CompilerConfiguration() | |
configuration.disabledGlobalASTTransformations = Collections.singleton(MacroTransformation.name); | |
def normalShell = new GroovyShell(configuration); | |
def macroShell = new GroovyShell(); | |
def r = benchmark { | |
'macro' { | |
macroShell.evaluate """ | |
assert "bytes" == propertyName("".bytes) | |
""" | |
} | |
'macroResult' { | |
macroShell.evaluate """import ru.trylogic.groovy.macro.runtime.MacroStub | |
assert "bytes" == MacroStub.INSTANCE.macroMethod('bytes') | |
""" | |
} | |
'normal' { | |
normalShell.evaluate """import ru.trylogic.groovy.macro.runtime.MacroStub | |
assert "bytes" == MacroStub.INSTANCE.macroMethod('bytes') | |
""" | |
} | |
} | |
r.prettyPrint() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Environment | |
=========== | |
* Groovy: 2.3.6 | |
* JVM: Java HotSpot(TM) 64-Bit Server VM (25.20-b23, Oracle Corporation) | |
* JRE: 1.8.0_20 | |
* Total Memory: 245.5 MB | |
* Maximum Memory: 3641 MB | |
* OS: Mac OS X (10.10.1, x86_64) | |
Options | |
======= | |
* Warm Up: Auto (- 60 sec) | |
* CPU Time Measurement: On | |
user system cpu real | |
macro 10248556 571083 10819639 10838803 | |
macroResult 6789871 355688 7145559 7206735 | |
normal 6714411 297911 7012322 7070146 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment