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 Summary
Constructors Constructor Description Performance2()
Default constructor. -
Method Summary
Modifier and Type Method Description Number
getObject()
Returns the object - caller has to use doubleValue() method.double
getObjectAsPrimitive()
Returns a double value generated from the Object - should be similar to previous method, but is not!void
getObjectAsPrimitiveLoop(int count)
Cycles through accessing the object as a primitive.void
getObjectLoop(int count)
Cycles through accessing the object.double
getPrimitive()
Just use double value - should be fast.Number
getPrimitiveAsObject()
Creates a Number object every time the primitive is accessed - should be really slow.void
getPrimitiveAsObjectLoop(int count)
Cycles through accessing the primitive as an object.void
getPrimitiveLoop(int count)
Cycles through accessing the primitive.static void
main(String[] args)
The starting point for the performance test.void
status(String label, Date start, Date end)
Outputs the current status to the console.
-
Constructor Details
-
Performance2
public Performance2()Default constructor.
-
-
Method Details
-
getPrimitive
public double getPrimitive()Just use double value - should be fast.- Returns:
- the double value.
-
getPrimitiveAsObject
Creates a Number object every time the primitive is accessed - should be really slow.- Returns:
- creates and returns a Number object.
-
getObject
Returns the object - caller has to use doubleValue() method.- Returns:
- an existing Number object.
-
getObjectAsPrimitive
public 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.
-
getPrimitiveLoop
public void getPrimitiveLoop(int count)Cycles through accessing the primitive.- Parameters:
count
- the number of times to access.
-
getPrimitiveAsObjectLoop
public void getPrimitiveAsObjectLoop(int count)Cycles through accessing the primitive as an object.- Parameters:
count
- the number of times to access.
-
getObjectAsPrimitiveLoop
public void getObjectAsPrimitiveLoop(int count)Cycles through accessing the object as a primitive.- Parameters:
count
- the number of times to access.
-
getObjectLoop
public void getObjectLoop(int count)Cycles through accessing the object.- Parameters:
count
- the number of times to access.
-
status
Outputs the current status to the console.- Parameters:
label
- the label.start
- the start time.end
- the end time.
-
main
The starting point for the performance test.- Parameters:
args
- ignored.
-