Skip to content

Instantly share code, notes, and snippets.

@bsideup
Created January 17, 2015 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsideup/74f3ea8a16f96ecbf5dc to your computer and use it in GitHub Desktop.
Save bsideup/74f3ea8a16f96ecbf5dc to your computer and use it in GitHub Desktop.
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()
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