JDK-8304420 : Regression ~11% with Javac-Generates on all platforms in b14
Type:Bug
Component:tools
Sub-Component:javac
Affected Version:21
Priority:P4
Status:Resolved
Resolution:Fixed
Submitted:2023-03-17
Updated:2024-01-12
Resolved:2023-03-20
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
This is referring to the new javac bmks at https://github.com/openjdk/jmh-jdk-microbenchmarks/tree/master/micros-javac
Appeared in retriage of 21-b14. Seems to be related to JDK-8303820
A pull request was submitted for review.
URL: https://git.openjdk.org/jdk/pull/13104
Date: 2023-03-20 16:42:00 +0000
20-03-2023
Codegen needs access to constant values - perhaps the new code for getting type metadata, which uses streams, is not as fast:
```
public <M extends TypeMetadata> Optional<M> getMetadata(Class<M> metadataClass) {
return metadata.stream()
.filter(m -> metadataClass.isAssignableFrom(m.getClass()))
.map(metadataClass::cast)
.findFirst();
}
```
Might be worth trying to replace that with a for loop, and measure again. Also, implementation of `constValue`:
```
public Object constValue() {
return getMetadata(TypeMetadata.ConstantValue.class)
.map(ConstantValue::value).orElse(null);
}
```
Perhaps using stream + optional is not great here.