-
Notifications
You must be signed in to change notification settings - Fork 4
Home
QuickPerf is a JUnit 4 extension that provides annotations to quickly evaluate some performance properties.
Each annotation can be applied at class level, at method level or for each test.
An annotation configured at method level overrides the configuration of this annotation defined at class level. An annotation configured for each test is overridden by the same annotation defined at class level or method level.
A Spring version will be available around February 2019.
A JUnit 5 version will be available around March 2019.
This annotation is based on ByteWatcher (https://github.com/danielshaya/ByteWatcher, https://www.javaspecialists.eu/archive/Issue232.html).
Parameter | Type | Meaning | Default value |
---|---|---|---|
value | long | Allocation value | - |
unit | AllocationUnit | Allocation unit | - |
@MaxAllocation(value = 440, unit = AllocationUnit.BYTE)
@Test
public void array_list_with_size_100_should_allocate_440_bytes() {
ArrayList<Object> data = new ArrayList<>(100);
}
This annotation is based on ByteWatcher (https://github.com/danielshaya/ByteWatcher, https://www.javaspecialists.eu/archive/Issue232.html).
@RunWith(QuickPerfJUnitRunner.class)
public class ClassWithMethodAnnotatedWithMeasureAllocation {
@MeasureAllocation
@JvmOptions("-XX:+UseCompressedOops -XX:+UseCompressedClassPointers")
// JVM options written as documentation. Indeed, QuickPerf works
// with JDK >= 7u40 where UseCompressedOops is enabled by default.
// UseCompressedClassPointers was introduced in JDK 8 and is
// enabled by default.
// MaxAllocation depends on UseCompressedOops and UseCompressedClassPointers.
@Test
public void array_list_with_size_100_should_allocate_440_bytes() {
// java.util.ArrayList: 24 bytes
// +
// Object[]: 16 + 100 x 4 = 416
// = 440 bytes
ArrayList<Object> data = new ArrayList<>(100);
}
}
Parameter | Type | Meaning | Default value |
---|---|---|---|
value | long | Heap size value (Xms=Xmx) | - |
unit | AllocationUnit | Allocation unit | - |
Parameter | Type | Meaning | Default value |
---|---|---|---|
value | long | Initial and minimum heap size value | - |
unit | AllocationUnit | Allocation unit | - |
Parameter | Type | Meaning | Default value |
---|---|---|---|
value | long | Maximum heap size value | - |
unit | AllocationUnit | Allocation unit | - |
Parameter | Type | Meaning | Default value |
---|---|---|---|
value | String | JVM options | - |
Parameter | Type | Meaning | Default value |
---|---|---|---|
value | int | Maximum number of returned columns | 0 |
Parameter | Type | Meaning | Default value |
---|---|---|---|
value | int | Maximum number of selects | 0 |
@MaxSqlSelect(1)
@Test
public void should_retrieve_all_cars() {
}
Parameter | Type | Meaning | Default value |
---|---|---|---|
value | int | Maximum number of inserts | 0 |
Parameter | Type | Meaning | Default value |
---|---|---|---|
value | int | Maximum number of updates | 0 |
Parameter | Type | Meaning | Default value |
---|---|---|---|
value | int | Maximum number of deletes | 0 |
π Β Core
π Β JVM
π Β SQL
π Β Scopes
π Β Create an annotation
π Β JUnit 4
π Β JUnit 5
π Β TestNG
π Β Spring
π Β Detect and fix N+1 SELECT
π Β Maven performance
π Β Spring Boot - JUnit 4
π Β Spring Boot - JUnit 5
π Β Micronaut Data - JUnit 5
π Β Micronaut - Spring - JUnit 5
π Β Quarkus - JUnit 5
π Β FAQ
π Β QuickPerf code