Created
May 29, 2015 11:55
-
-
Save jonatasemidio/14ad2dbdf0aa05bf5a44 to your computer and use it in GitHub Desktop.
What is my mistake?
This file contains 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
@Grab( 'com.googlecode.gbench:gbench:0.3.0-groovy-2.0' ) | |
import gbench.* | |
def i = 0 | |
new BenchmarkBuilder().run( measureCpuTime:true ) { | |
'TEST:' { | |
1000000.times{i?.toLong() ? i?.toLong() : null} | |
} | |
'TEST:' { | |
1000000.times{i?.toLong() ? i?.toLong() : null} | |
} | |
}.prettyPrint() | |
/** | |
Me: Why Do I have a different result for the same code? | |
Environment | |
=========== | |
* Groovy: 2.4.0 | |
* JVM: Java HotSpot(TM) 64-Bit Server VM (21.0-b17, Oracle Corporation) | |
* JRE: 1.7.0 | |
* Total Memory: 127 MB | |
* Maximum Memory: 127 MB | |
* OS: Windows 7 (6.1, amd64) | |
Options | |
======= | |
* Warm Up: Auto | |
* CPU Time Measurement: On | |
user system cpu real | |
TEST: 134550862 0 134550862 133996441 | |
TEST: 140400900 0 140400900 140462451 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment