java.lang.Object
perf.MeasurePerformance
Simple micro-benchmark for evaluating performance of various UUID generation
techniques, including JDK's method as well as JUG's versions.
Notes: for name-based version we will pass plain Strings, assuming this is the most common use case; even though it is possible to also pass raw byte arrays. JDK and Jug implementations have similar performance so this only changes relative speeds of name- vs time-based versions.
- Since:
- 3.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final byte[]private static final Stringprivate final intprivate final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidvoidtest()private final voidprivate final voidtestJDKNames(Object[] uuids, int rounds) private final voidtestNameBased(Object[] uuids, int rounds, StringArgGenerator uuidGen) private final voidtestRandom(Object[] uuids, int rounds, RandomBasedGenerator uuidGen) private final voidtestTimeBased(Object[] uuids, int rounds, TimeBasedGenerator uuidGen)
-
Field Details
-
NAME_STRING
- See Also:
-
NAME_BYTES
private static final byte[] NAME_BYTES -
COUNT
private static final int COUNT- See Also:
-
DEFAULT_ROUNDS
private static final int DEFAULT_ROUNDS- See Also:
-
rounds
private final int rounds -
runForever
private final boolean runForever
-
-
Constructor Details
-
MeasurePerformance
public MeasurePerformance() -
MeasurePerformance
public MeasurePerformance(int rounds, boolean runForever)
-
-
Method Details
-
test
- Throws:
Exception
-
testJDK
-
testJDKNames
- Throws:
IOException
-
testRandom
-
testTimeBased
-
testNameBased
-
main
- Throws:
Exception
-