Created
April 17, 2014 15:24
-
-
Save ckaminski/10991769 to your computer and use it in GitHub Desktop.
SysPropTest - demonstrates how long it takes a particular java runtime to iterate through one billion invocations of System.getProperty(). There's possibly some efficiencies in this tight loop, so this is a best case. Authored to test likely impact of a planned Property adapter/facade.
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
import java.lang.*; | |
public class SysPropTest { | |
public static void main(String[] args) { | |
final String propName = "com.example.test.PropertyName"; | |
long start = System.currentTimeMillis(); | |
for (int i = 0; i < 1000000000; i++ ) { | |
String val = System.getProperty(propName); | |
val = "abcdef"; | |
} | |
long end = System.currentTimeMillis(); | |
long diff = end - start; | |
System.out.println("ElapsedTime = " + Long.toString(diff) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment