Package org.jfree.chart.demo
Class Performance2
java.lang.Object
org.jfree.chart.demo.Performance2
public class Performance2 extends Object
A basic performance test for a couple of common operations.
- 
Constructor SummaryConstructors Constructor Description Performance2()Default constructor.
- 
Method SummaryModifier and Type Method Description NumbergetObject()Returns the object - caller has to use doubleValue() method.doublegetObjectAsPrimitive()Returns a double value generated from the Object - should be similar to previous method, but is not!voidgetObjectAsPrimitiveLoop(int count)Cycles through accessing the object as a primitive.voidgetObjectLoop(int count)Cycles through accessing the object.doublegetPrimitive()Just use double value - should be fast.NumbergetPrimitiveAsObject()Creates a Number object every time the primitive is accessed - should be really slow.voidgetPrimitiveAsObjectLoop(int count)Cycles through accessing the primitive as an object.voidgetPrimitiveLoop(int count)Cycles through accessing the primitive.static voidmain(String[] args)The starting point for the performance test.voidstatus(String label, Date start, Date end)Outputs the current status to the console.
- 
Constructor Details- 
Performance2public Performance2()Default constructor.
 
- 
- 
Method Details- 
getPrimitivepublic double getPrimitive()Just use double value - should be fast.- Returns:
- the double value.
 
- 
getPrimitiveAsObjectCreates a Number object every time the primitive is accessed - should be really slow.- Returns:
- creates and returns a Number object.
 
- 
getObjectReturns the object - caller has to use doubleValue() method.- Returns:
- an existing Number object.
 
- 
getObjectAsPrimitivepublic double getObjectAsPrimitive()Returns a double value generated from the Object - should be similar to previous method, but is not!- Returns:
- the doubleValue() for the Number.
 
- 
getPrimitiveLooppublic void getPrimitiveLoop(int count)Cycles through accessing the primitive.- Parameters:
- count- the number of times to access.
 
- 
getPrimitiveAsObjectLooppublic void getPrimitiveAsObjectLoop(int count)Cycles through accessing the primitive as an object.- Parameters:
- count- the number of times to access.
 
- 
getObjectAsPrimitiveLooppublic void getObjectAsPrimitiveLoop(int count)Cycles through accessing the object as a primitive.- Parameters:
- count- the number of times to access.
 
- 
getObjectLooppublic void getObjectLoop(int count)Cycles through accessing the object.- Parameters:
- count- the number of times to access.
 
- 
statusOutputs the current status to the console.- Parameters:
- label- the label.
- start- the start time.
- end- the end time.
 
- 
mainThe starting point for the performance test.- Parameters:
- args- ignored.
 
 
-